Don't know what you're trying to achieve. Better to ask questions at SyntaxBomb as that is where most of the BlitzMax users have gone.
Anyway, I gave it a go here.
SuperStrict' drawline.bmx
' draws a hair at the mouse position using Drawline.
'A type for a single polygon
Type TPolygon
Field Points:Float[]
End Type
'A polygon must be convex so we create a Shape type to
' hold several polygons to make more complex shapes
Type TShape
Field Polygons:TList = CreateList()
'Adds a single polygon to the shape
Method Add(Points:Float[])
Local Polygon:TPolygon = New TPolygon
Polygon.Points = Points
Polygons.AddLast(Polygon)
End Method
'draws all the polygons
Method Draw(x:Float, y:Float)
Local OriginX:Float, OriginY:Float
GetOrigin(OriginX, OriginY) 'store the origin
SetOrigin x,y 'set the origin to the polygon's location
For Local Polygon:TPolygon = EachIn Polygons 'draw the polygons
DrawPoly Polygon.Points
Next
SetOrigin OriginX,OriginY 'restore the origin
End Method
End Type
Local Star:TShape = New TShape 'create the star shape
Local Point:Float[] 'an array to hold each point of the star
For Local i:Int = 0 Until 5 '5 points
Local Angle:Float = i * 72 - 90
Point = New Float[6] 'create a new array to hold the points
Point[0] = Cos(Angle) * 30
Point[1] = Sin(Angle) * 30
Point[2] = Cos(Angle+36) * 11.459
Point[3] = Sin(ANgle+36) * 11.459
Point[4] = Cos(Angle-36) * 11.459
Point[5] = Sin(Angle-36) * 11.459
Star.Add(Point)
Next
Graphics 640,480
HideMouse
While Not KeyHit(KEY_ESCAPE)
Cls
Local x:Int=MouseX()
Local y:Int=MouseY()
DrawLine 32,24,x,y
Star.Draw(x,y)
Flip
Wend
← Return to game
Comments
Log in with itch.io to leave a comment.
Blitz Max.
' drawline.bmx
' draws a hair at the mouse position using Drawline.
Graphics 640,480
HideMouse
While Not KeyHit(KEY_ESCAPE)
Cls
x=MouseX()
y=MouseY()
DrawLine 32,24,x,y
DrawLine x-2,y,x-10,y
DrawLine x+2,y,x+10,y
DrawLine x,y-2,x,y-10
DrawLine x,y+2,x,y+10
Flip
Wend
How will it be possible to draw a star instead of hair.?
How will I set my codings?
Don't know what you're trying to achieve. Better to ask questions at SyntaxBomb as that is where most of the BlitzMax users have gone.
Anyway, I gave it a go here.
SuperStrict' drawline.bmx ' draws a hair at the mouse position using Drawline. 'A type for a single polygon Type TPolygon Field Points:Float[] End Type 'A polygon must be convex so we create a Shape type to ' hold several polygons to make more complex shapes Type TShape Field Polygons:TList = CreateList() 'Adds a single polygon to the shape Method Add(Points:Float[]) Local Polygon:TPolygon = New TPolygon Polygon.Points = Points Polygons.AddLast(Polygon) End Method 'draws all the polygons Method Draw(x:Float, y:Float) Local OriginX:Float, OriginY:Float GetOrigin(OriginX, OriginY) 'store the origin SetOrigin x,y 'set the origin to the polygon's location For Local Polygon:TPolygon = EachIn Polygons 'draw the polygons DrawPoly Polygon.Points Next SetOrigin OriginX,OriginY 'restore the origin End Method End Type Local Star:TShape = New TShape 'create the star shape Local Point:Float[] 'an array to hold each point of the star For Local i:Int = 0 Until 5 '5 points Local Angle:Float = i * 72 - 90 Point = New Float[6] 'create a new array to hold the points Point[0] = Cos(Angle) * 30 Point[1] = Sin(Angle) * 30 Point[2] = Cos(Angle+36) * 11.459 Point[3] = Sin(ANgle+36) * 11.459 Point[4] = Cos(Angle-36) * 11.459 Point[5] = Sin(Angle-36) * 11.459 Star.Add(Point) Next Graphics 640,480 HideMouse While Not KeyHit(KEY_ESCAPE) Cls Local x:Int=MouseX() Local y:Int=MouseY() DrawLine 32,24,x,y Star.Draw(x,y) Flip WendThis game is not compatible with my notebook
What are your laptop's specifications? CPU, OS, video? What happens when you try and execute the game? What errors do you get?