Hello, first post here. Not new to the forums, lurked a lot for DB help but it's the first time my problem seems to be affecting me alone. Anyway...
I'm working on a school project right now for a 2D space shooter. The idea is to have your ship moveable by using the left and right arrow keys (working) and shooting your ship's laser at enemy ships to advance.
At the moment, I can move the ship left and right, but a copy of the ship's sprite is staying in one spot as seen here: http://i.imgur.com/xH25h.jpg
Basically, the ship on the right is movable but the one on the left stays there and doesn't move. I'm sure you also noticed my lovely blue screen of white dots. That's supposed to be back with the stars but for whatever reason it's not loading in the image correctly. Anyway, I'll show the code and hopefully you guys can help.
Sync On
Sync Rate 60
Set display mode 800,600,32
autocam off
backdrop off
gosub variables
variables:
load image "space.jpg",1
load image "Ship.jpg",2
load image "bullet.jpg",3
load image "Enemy Ship.jpg",4
xpos = 100
ypos = 500
bulletx = xpos
bullety = ypos
gosub game_setup
gosub player_movement
game_setup:
sprite 1,0,0,1
Sprite 2,xpos,ypos,2
sprite 3,bulletx,bullety,3
player_movement:
do
If leftkey()=1 and xpos =>0 then xpos = xpos - 5
If rightkey()=1 and xpos <=750 then xpos = xpos + 5
paste sprite 2,xpos,ypos
if spacekey()=1 then gosub bulletmove
bulletmove:
bullety = bullety - 10
sprite 3,bulletx,bullety,5
if bullety = 0 then bullety = ypos
Sync
loop
My question to you guys is, how can I get rid of the ship that doesn't move as well as fix my background? If you've read my code, you'll probably also have seen the bullet coding, but it's a WIP and I just thought I'd include it here in case that's causing these problems.
Thanks for reading, and thanks in advance for any help given.