Geeks With Blogs

News

Tonight was just one of those nights. I just couldn't seem to wrap my mind around any of the little game glitches I was trying to iron out tonight. It seemed like the simplest things were just causing me major amounts of headaches.

One of the issues I was trying to figure out tonight was how to get Bob's kids to follow him properly in the "Follow the Leader" level. I had it working, but the fish were kind of jumpy and Bob was always in constant collision with the first two of his children so I was trying to improve upon that.

I got no where. Looking online for any examples or samples wasn't much of a help, seems like I'm taking quite a different approach from all the stuff I'm seeing. I'm not sure if that's a good thing or a bad thing. Most examples I've seen take a grid like approach to a "snake" game. So their snake moves exactly one square. For my level, I'm moving Bob in an X,Y direction based on his current velocity and how many seconds have elapsed since he was last updated. So the logic for how to get his children to follow him is just a bit different and I still don't have it working properly after fiddling with it for hours.

I don't know. Maybe I just need a good nights sleep and I'll have an "a ha!" moment tomorrow, but tonight, just frustration.

Related Posts on Geeks With Blogs Matching Categories

Comments on this post: A Night of Frustration

# re: A Night of Frustration
I'm assuming his children aren't supposed to run into him right? If that's the case, why not add a simple if statement to your collision detectionm like this:

{
Collosion=false;
}
else
{
//Normal collision detection here
}
Left by thorkia on Jun 02, 2006 4:48 AM

# re: A Night of Frustration
Well, are you familiar with the game "centipede" or "snake"? That's the type of gameplay I'm trying to achieve.

His children follow him along his exact path, but he can collide with them. The goal is for the character to avoid bumping into his own tail. In this case my characters tail is made up of his children.

So it's not as much of a collision detection issue that's causing me to pound my head off my keyboard, it's getting the children to follow him on his bath properly while still keeping the appropriate spacing and making the same twists and turns the "leader" made at the right times all while having the movement look smooth.
Left by George on Jun 02, 2006 5:30 AM

# re: A Night of Frustration
Just read over your whole blog and I'm very impressed with both your ambitiousness and your progress! Keep up the great work and good luck! :)
Left by HopeDagger on Jun 02, 2006 6:35 AM

# re: A Night of Frustration
Do you check if the children collide with something? Becuase if this is truly centipede like, you shouldn't need to check if you children have collided with something. You just need to check if something hit them (your Daddy fish, or other moving obstacles).

if you children fish's rectangle is the same size as the parent fish, then you can handle the following by using a customer structure and a list. Your structure needs the x,y location and the button pressed or whatever you want to use.

Everytime a key is pressed that changes the directions, you add an item to your list. Then, as your children reach the points, you enact the change on them. Once all children have passed a point, you remove it from the list. Only one catch with this method -> You can't change your speed easily with out extra checks.
Left by thorkia on Jun 02, 2006 8:34 AM

# re: A Night of Frustration
I'm on the same page as thorkia here. You really want a system of "waypoints"/"checkpoints". Basically, every time that Bob turns you add a waypoint to a list.

Then the only thing the children are concerned with is: 1) Stay a constant distance from the person in front of me (this really begs of some sort of association like a linked list) (this way, if the fish in front of me speeds up, I speed up; if it slows down, I slow down, etc.) and 2) Go to the next waypoint. Those are the only two things the child fish AI is worried about.

Does that make sense?
Left by Jason Olson on Jun 03, 2006 12:22 PM

# re: A Night of Frustration
In other words (when it comes to matching speed and collision detection), each child fish doesn't actually track it's own velocity (not really). Every fish has a reference to the fish directly in front of it. Then he says: 1) Match the velocity of the fish in front of me, 2) If the distance between me and the fish in front of me has increased since last time, speed up, 3) If the distance between me and the fish in front of me has decreased since last time, slow down.
Left by Jason Olson on Jun 03, 2006 12:24 PM

# re: A Night of Frustration
dude!! wake up, your pits are sweaty!!

How was gamefest? Ya bastid...
Left by you know who on Aug 16, 2006 5:34 AM