When i press the fire key my bullet just appears above my sprite no matter what direction it is facing. I though i had the right code in but something is not right. Can some look it over to see if there is something noticeable.
sync on :sync rate 60
backdrop on
color backdrop rgb(255,255,255)
x=200: y=200 : a=0
load image "BitmapGalactic Wars.bmp" ,1
load image "BitmapShot.bmp", 2
playersprite=1
sprite playersprite,x,y,1
flip sprite playersprite
offset sprite playersprite, sprite width(playersprite)/2, sprite height(playersprite)/2
do
oldx=sprite x(playersprite)
oldy=sprite y(playersprite)
if keystate(17)=1 then move sprite playersprite,5
if keystate(30)=1 then a=wrapvalue(a-5) : rotate sprite playersprite,a
if keystate(32)=1 then a=wrapvalue(a+5) : rotate sprite playersprite,a
If sprite x(playersprite)<0
sprite playersprite,oldx,oldy,sprite image(playersprite)
endif
If sprite x(playersprite)>screen width()
sprite playersprite,oldx,oldy,sprite image(playersprite)
endif
If sprite y(playersprite)<0
sprite playersprite,oldx,oldy,sprite image(playersprite)
endif
If sprite y(playersprite)> screen height()
sprite playersprite,oldx,oldy,sprite image(playersprite)
endif
If Wait#=0
If Controlkey()=1
Sprite 2,Sprite X(1),Sprite Y(1),2
Rem Offset The Bullet so its Rotation is in the center
Offset Sprite 2,10,40
Rem Rotate the Bullet to match the ships Direction
Rotate Sprite 2,y#
Rem Move the sprite closer to the ships Gun
Move sprite 2,1
Rem Increase the bullet Sprite number by 1
Inc 2
Wait#=5
Rem End if loop
Endif
Rem End if loop
Endif
Rem Decrease Wait for a new bullet
dec Wait#
if Wait#<0 then Wait#=0
sync
loop
mod edit [indi] your code tags were back to front [ / c o d e ] your [ c o d e ]
this is correct without spaces [ c o d e ] yourcode [ /c o d e ]
the code button will make life easier if you forget.
The Internet Is TUBES