Page 1 of 1

Posted: Sun May 19, 2002 1:48 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

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) 
http://www.purehilfe.de.vu

Posted: Sun May 19, 2002 2:11 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

[quote]
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 X_MAX
DeleteElement(bullet())
Else
bullet()\x + bullet()\speed
DisplaySprite(0,bullet()\x , bullet()\y)
EndIf
Wend

FlipBuffers()
Until KeyboardPushed(#PB_KEY_ESCAPE)
[/code]
I haven't tested the code, but it should work in theory anyway :wink:

Posted: Sun May 19, 2002 3:11 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

little bit buggy but the theory works.

thx pupil

http://www.purehilfe.de.vu