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.

Dark GDK / A couple of questions about a 2d game?

Author
Message
Mgreen2010
13
Years of Service
User Offline
Joined: 19th Aug 2010
Location:
Posted: 20th Aug 2010 03:43
I have a couple of questions with some code that I have been racking my brain on all day and can't find any answers for. If anyone could help that would be great.

Question 1.
using the dbSpaceKey() I am trying to shoot an object up to the top of the screen using the space bar. I have it where it shoots when you press the space bar but if you hit the space bar while it is traveling it will stop mid screen and continue up the screen after it has been depressed. I am looking for it to shoot straight with out any interference from key interaction.


Question 2.
I have an object flying across the screen and when it collides with the object flying up the screen I was trying to show a second image to make it look like it popped. I have the collision working but I can't figure out how to display the second image where the last image collided and deletes.



Question 3.
What is the easiest way to duplicate many images to fly across the screen? I have tried plenty of for loops and can't seem to get it.


That is all of my questions for the day. I really hate to ask for help but I could not get these figured out. Thank you
marlou
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 20th Aug 2010 08:32
For the second one:


For the first one



When a person has nothing but a dream, can he dare to dream.
Mgreen2010
13
Years of Service
User Offline
Joined: 19th Aug 2010
Location:
Posted: 21st Aug 2010 03:10
Thank You Marlou. That worked very well for what I was trying to do.

Now if someone could help with third question.

Question 3.
What is the easiest way to duplicate many images to fly across the screen? I have tried plenty of for loops and can't seem to get it.
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 24th Aug 2010 19:37
have multiple sprites to have multiple bullets.
say that you want 25 bullets max on the screen.
then use 1 to 25 dbSprite to keep track of each bullet.

if it is animated sprite then choose a range for the first bullet.
if the range is 10 and u want 25 bullets.
have the first 10 sprites decribe the first bullet and so on. Then keep track of each individual sprite and if it collides or not.

Go through yourself at a wall.

Login to post a reply

Server time is: 2024-07-02 09:00:51
Your offset time is: 2024-07-02 09:00:51