Makeing instances and updating them.

BlitzMax Forums/BlitzMax Beginners Area/Makeing instances and updating them.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

ok here is my bullet type it looks good to me but it creates an error saying type global initializers must be constant.

Type Bullet
Field x,y,direction,speed
Global Bullet_List:TList = CreateList()

Function create(x,y,direction,speed)
temp_shot:Bullet= New Bullet
temp_shot.x=x
temp_shot.y=y
temp_shot.direction=direction
temp_shot.speed=speed
ListAddLast(Bullet_List,temp_shot)
EndFunction

Function draw()
Local temp_shot:Bullet=Bullet(Bullet_List.last())
SetColor 235,200,124
DrawOval 32,32,x-16,y-16
EndFunction

Function update()
Local temp_shot:Bullet=Bullet(Bullet_List.last())
temp_shot.draw()
' make the x and y move
temp_shot.x:+ speed*Cos(direction)
temp_shot.y:+ speed*Sin(direction)
EndFunction

Function destroy()
ListRemove(Bullet_List,Self)
EndFunction

EndType