hi guys
i have a problem, ive code a small example to shoot a bullet but it dosent work my pb compiler crashs. Here is the code would be very glad if someone can find the errors where i think that it isnt a erro <:(.
Code: Select all
InitSprite()
InitKeyboard()
OpenScreen(1024,768,32,"TEst")
LoadSprite(0,"bullet.bmp",0)
Structure bullet
x.l
y.l
speed.l
EndStructure
NewList bullet.bullet()
Procedure shoot_bullet()
AddElement(bullet())
While NextElement(bullet())
bullet()\x = 200
bullet()\y = 200
bullet()\speed = 3
Wend
EndProcedure
Repeat
ClearScreen(64,255,64)
ExamineKeyboard()
If KeyboardPushed(#PB_KEY_SPACE)
shoot_bullet(200,200,4)
EndIf
ResetList(bullet())
While NextElement(bullet())
DisplaySprite(0,bullet()\x + bullet()\speed, bullet()\y)
Wend
FlipBuffers()
Until KeyboardPushed(#PB_KEY_ESCAPE) 