Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Sprite not moving correcting, background image not displaying properly either.

Author
Message
Darkwatch67
12
Years of Service
User Offline
Joined: 31st Jan 2012
Location:
Posted: 31st Jan 2012 20:24
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.



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.
Wamphyri
12
Years of Service
User Offline
Joined: 29th Jan 2012
Location:
Posted: 31st Jan 2012 21:58
I hope you dont mind I changed what you did to this



If works better for me now. Might not exactly be what you want and I had to change the file names to put in dummy files for me but it works a little better now.
Wamphyri
12
Years of Service
User Offline
Joined: 29th Jan 2012
Location:
Posted: 31st Jan 2012 22:41
Also to stop the bullet from appearing before you shoot delete first Sprite 3 line since it is in the bulletmove: subroutine also.
Darkwatch67
12
Years of Service
User Offline
Joined: 31st Jan 2012
Location:
Posted: 31st Jan 2012 23:30 Edited at: 31st Jan 2012 23:32
Amazing! Everything is working perfectly now, thank you! I didn't actually notice that I'd put the line for displaying the bullet in twice, so thanks for the note!

I've just got one more quick question, my next step will be moving onto collision detection, and I read into the Sprite Hit command and was just wondering if it would work in my case? Seems easy enough, just add code for deleting the sprite if it comes into contact with the laser?

Thanks again.

Login to post a reply

Server time is: 2024-11-23 23:46:59
Your offset time is: 2024-11-23 23:46:59