Thursday, October 14, 2010

Bullet Collision

So I'm extremely tired and have almost no brain power left. I think my exhaustion from the rest of the week have caught up with me tonight. This asteroid clone is taking me much longer than expected, but I'm determined to get it complete!

So my "meteors" weren't drawing because I was passing the meteor shape variable by value to my add point function, and not my reference. That would explain why the points didn't "save" themselves when the function was done. This simple mistake made me laugh when I realized how small it was, but now I just feel like I have so much to learn when it comes to C++.

Here's how it looks so far (I love pictures, haha.)

And yes, the meteors can move. But unfortunately I don't know much about the sf::Randomizer class and wrapping seeds, so they all move in the same general direction (the bottom right for some reason). I'm trying to get the functionality of my program to work and then I'll fix those little details.

So I tried writing function that would check if a point is the same as the meteors, for collision.

for(int i=0; i < (numofpoints-1); i++)
{
if (i == 0)
{
if(Y == meteorShape.GetPointPosition(i).y)
{
checkY = true;
break;
}
}
else if ((Y >= meteorShape.GetPointPosition(i).y) && (Y <= meteorShape.GetPointPosition(i+1).y))
{
checkY = true;
break;
}
}

So... it doesn't work. I'm not sure if it's because of this "checking point" function or something else, I'm almost positive the problem's here though. I'll find and fix it by the next post!

1 comment:

  1. hey catrinat, im really curious as to you finishing your game, or at least to the point where its playable. i am also someone who knows a bit of c++ and is *attempting* to learn sfml.

    i dont know about you, but i learn best from other peoples code. ya know like figuring out why and how they did certain things. so if you want you could send over the game your working on, and ill reply with one or two of mine.

    from what i read,you can be quite busy, so if you found other interests besides sfml, thats fine. but you can always contact me at miccim15@yahoo.com thank you

    ReplyDelete