Hello, I'm making a 2D side scrolling shooter and I'm having a slight problem with the drawing order of the background and the bullet shooting process.
My background (which scrolls perfectly using the SET SPRITE TEXTURE COORD command) draws first each time, over top of the the ship sprite and all other sprites that are drawn. I've tried using SET SPRITE PRIORITY However that does not work.
x# = x# + 0.001
set sprite texture coord 100, 0, 0.0 + x#, 0.0
set sprite texture coord 100, 1, 1.0 + x#, 0.0
set sprite texture coord 100, 2, 0.0 + x#, 1.0
set sprite texture coord 100, 3, 1.0 + x#, 1.0
sync
return
load bitmap "backdrop.png",30
set current bitmap 30
get image 100,0,50,1249,625,0
set current bitmap 0
delete bitmap 30
set current bitmap 0
sprite 100,0,0,100
set sprite priority 100,1
hide all sprites
and this is the main loop
do
cls
gosub update_bullets
gosub pilot
gosub update_player
gosub scroll
text 0,15,"FPS: "+str$(screen fps())
sync
loop
For the bullets, I want to be able to only have 3 bullets on the screen at once, and only shoot if you have not shot a bullet in a certain time
These are my bullet handling sub-routines
fire:
if bullet_current>bullet_count
gosub update_bullets
else
bullet(bullet_current).x=bx+5
bullet(bullet_current).y=by
bullet(bullet_current).xs=3
bullet(bullet_current).ys=0
bullet(bullet_current).state=1
inc bullet_current,1
endif
return
update_bullets:
for b=0 to bullet_count
if bullet(b).state>0
inc bullet(b).x,bullet(b).xs
inc bullet(b).y,bullet(b).ys
if bullet(b).x>640 or bullet(b).x<0
bullet(b).state=0
dec bullet_current,1
endif
if bullet(b).y>480 or bullet(b).y<0
bullet(b).state=0
dec bullet_current,1
endif
paste image 1000,bullet(b).x,bullet(b).y
endif
next b
sync
return
Thanks in advance
Rocko