Hi, guys.. I'm relatively new to all this so I'll try to be as clear as I can.. I'm making a game in which you control an object that is on the bottom of the screen.. There are objects falling from the top and your goal is to catch them and not let them pass you.. I thought about making a queue of pointers that will point to the objects and going through them in a for loop while substracting from the Y coordinate... Anyway, my original code is not working, so I was wondering can you provide me with some links of code on how it is done ?
Sorry have not done this my self, but would love to see your game when your finished.
I'm also going to assume there are several ways to do what your talking about, but the one that came to my mind is when your falling object arrives at the Y coordinate where the paddle or net is, you should put in a check to see if the paddle/net is between X40-X45 or what ever the size of your object is.
Well, actually, yes. I thought in that direction as well.. I was thinking about making a queue of circles ( Krug = Circle in Serbian :) ) and whenever an object from queue.front() comes in the Y coordinate of the net ( or a little lower, it drops out ) it's deleted from the queue.. Don't even know is it possible to do this, any help would be appreciated.. Here's the code, but I don't know is it of any good :
So, whenever a period of time passes
sf::Shape* p = new sf::Shape();
Krug.SetPosition( (float)(rand() % 800) , 0.0);
*p=Krug;
red.push(p);
I make a new object and send its refference to the queue.. And
p=red.front();
if (p->GetY==Net.Y)
red.pop();
delete p;