5
$\begingroup$

I'm making a very simple game where you, playing with a helicopter, have to drop off people in difficult areas. Though it might be a fun game, it's more of an exercise to get used to python.

I'm almost there, so most things work. The problem now is that when I drop the AI characters, they land on the exact same spot; so they land on each other. What I want is that every character, when landed, walks to a random position in certain area around the landing zone.

1) is this possible or am I asking too much?
2) remark: the characters are just jumping out of the heli, not with a parachute or anything ;)

$\endgroup$
2
  • 1
    $\begingroup$ you could have an empty, 100 frames animated to different random positions, ray-casted onto the ground. When the people land, the should head toward the empty's current position, and then it should play a random number of frames to get set to the next position. $\endgroup$
    – ruckus
    Commented Aug 8, 2015 at 15:25
  • 1
    $\begingroup$ I suggest you edit your question from "computer movement" - which is to broad -> into "how to let characters walk to random locations" or "how to let characters walk into random directions" (two different things) $\endgroup$
    – Monster
    Commented Aug 10, 2015 at 5:37

1 Answer 1

3
$\begingroup$

Okay, here's how to drop people from a helicopter then have them clear the landing zone when they hit.

First, make your basic setup. right now, mine is a helicopter that drops Suzannes when you hit Spacebar.

enter image description here

1- Make the spawner rotate

This will ensure that the people are rarely facing the same direction when they hit the ground. This could be the helicopter itself, or an invisible empty that spawns the people. Make it rotate on the Z axis (not local) at any speed you want.

2- Create a "landing zone"

This is an invisible cylinder with ghost static physics. Give it the property "Zone" and your ground the property "G" or "Ground". This landing zone is the area that the people will attempt to clear when they hit "G". Make sure both objects are "Actors".

3- Give the movement behavior to your people

The people aren't going anywhere without logic! give them a "Motion" actuator rigged up to an "Always" sensor. Make sure it is local movement and not global. (make the little "L" next to the motion box shaded)

4- Organize the states

You don't want the people running until they hit the ground. You can do this a myriad of ways, but the easiest is to replace the always sensor from above with a collision sensor looking for the property "G". Next, make another collision sensor that looks for "Zone". this will tell the people when they are clear of the helicopter. When the sensor is triggered, send them to state 2, using a "Set State" actuator. On state 2 put all the logic for what you want them to do when they have safely landed.

5- Profit!

Now you have the system all set up and with logic that is easy to change or adjust.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .