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.
int dart::reset()
{
if(dbSpaceKey() == 1 && dbSpriteExist(dartId) == 0)
{
dbSprite(dartId, 320, 435, 3);
}
return(0);
}//end reset
int dart::movement()
{
if(dbSpaceKey() == 0 && dbSpriteExist(dartId) == 1)
{
dbMoveSprite(dartId, 15);
}
return(0);
}//end movement
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.
int bubble::collision()
{
if(dbSpriteCollision(bubId, 5) == 1)
{
dbDeleteSprite(bubId);
}
if(dbSpriteCollision(bubId, 3) == 1)
{
dbDeleteSprite(bubId);
/*This is where I load the popped image when it collides*/
dbLoadImage("bubBurst.bmp", 8);
//trying to figure out how to find the location of where
//the object was popped from
}
return (0);
}
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