ich habe mal so bissl rumgespielt mit PureBasic, und ich habe einen Soldaten, und wenn der Spieler MouseButton(1) drückt, dann schiesst er. Ok, dass alles tut er, nur ich will das er nach Rechts schiesst und nicht nach Links. Ich weiß irgendwie nich mehr weiter. Kann mir da einer helfen?
Code: Alles auswählen
Structure bullet_struc
pos_x.w
pos_y.w
speed_x.w
speed_y.w
graphic.w
EndStructure
NewList bullet.bullet_struc()
InitSprite() And InitKeyboard() And InitMouse()
PlayerX = 20
PlayerY = 600
OpenScreen(1024,768,32,"WW2-NS")
; GRAPHICS
LoadSprite(1,"gfx/soldat.bmp")
LoadSprite(2,"gfx/bullet.bmp")
Repeat
ClearScreen(0,0,0)
ForEach bullet()
bullet()\pos_x = bullet()\pos_x + bullet()\speed_x
bullet()\pos_y = bullet()\pos_y + bullet()\speed_y
DisplaySprite(bullet()\graphic, bullet()\pos_x, bullet()\pos_y)
If bullet()\pos_y <= 0
DeleteElement(bullet())
EndIf
Next bullet()
DisplaySprite(1, PlayerX,PlayerY)
FlipBuffers()
If KeyboardPushed(#PB_Key_D)
PlayerX + 6
EndIf
If KeyboardPushed(#PB_Key_A)
PlayerX - 6
EndIf
If MouseButton(1)
If space = 0
space = 1
AddElement(bullet())
bullet()\pos_x = PlayerX
bullet()\pos_y = PlayerY
bullet()\speed_y = 0
bullet()\speed_x = -20
bullet()\graphic = 2
EndIf
Else
space = 0
EndIf
ExamineKeyboard()
ExamineMouse()
Until MouseButton(2)
Edit by NicTheQuick: Thread-Titel aussagekräftiger gemacht