GE Animation Outside Actions

I’m working on a simple game for one of my beginning projects. I know how to some basic things work, but I just can’t figure this out. I wanted to know how to create animations outside of actions? I have basically what I want to do listed, and I’ve figured out how to do about half at the moment.

  • Timer starts, Player and Rival now movable.
  • Player is near Rival. The Rival panics and User can see visible movement, but he doesn’t move.
  • Player touches Rival. Rival runs opposite direction being chased, and can run into walls, but not go through them.
  • Player touches Rival and uses “kick” action and receives an “egg”. Rival goes flying off screen, hits the ground, disappears, and regenerates in a new place.
  • Timer ends. Player transferred to new scene and number of “eggs” saved.

I’ve managed to have my Player and Rival both use Actions and sensors for each other. They both animate based on stationary moves and with each other, but besides that I’m stuck.

I would like my Rival to move away from Player when he’s “touched” or near, but I can’t make him run away. Also, I can’t figure out how to make him physically be kicked by the player (so he goes flying off the screen), disappears, or regenerate within a certain area. I plan on duplicating the Rival and also the use of a timer that will send the Player into a new scene if that makes a difference. ^_^; I’m not familiar with Python…

So any suggestions? Or does anyone know of any good tutorials I can view to help me expand my knowledge?

for interaction like this you currently have to use python.
since away is a relative direction between 2 objects.
once you get the basics of python you only need to have a ray/rayar sensor, then get the objects in the field. adjust the linv (directly, without an actuator) of the objects you want to have some impact on them.

In YoFrankie 1.1 see chars/frankie_scripts/action_all.py, this includes kicking logic.

I’m not sure exactly what you mean… “create animations outside of actions” ? Do you mean have characters move (their position)?

All of the things you want to do seem like they’d be definitely doable with logicbricks.

Make sure both objects (player and rival) are dynamic. Also, your running animations should not involve any positional change on the X and Y axis… it should look like they’re running in place. Movement is all added using logicbricks.

“Running away” is easy with a track-to actuator and a motion actuator: make your “rival” character face towards the -Y (negative Y) axis, and use the track-to actuator (which makes your object point its Y-axis at the specified object) with your player’s object’s name in the actuator. Then use a motion actuator for him to run away.

You can use near and collision sensors to do things like items 2-4. They should be pretty self-explanatory… just play with it!

To do a melee-type attack, you could create an empty parented to your player object. It could add an invisible projectile that only lasts for a few frames. If your “rival” character gets hit by the projectile, then you can use the motion actuator to apply a lot of force (or use Servo) to make him “fly off”.

Try playing with settings… that’s how you learn the best!

-Sam

Thanks for the advice, I’ve been experimenting with the program and I’ve actually have gotten almost everything that I want to happen with the characters with LogicBlock. I had to set my characters to Dynamic, then prevent them from flying off into space, but now they’re working okay.

They still run through walls, which I haven’t been able to stop, and I’ve yet to figure out how to make it when the enemy is kicked it waits before ending the object and relocating it. It’s very frustrating. I also can’t seem to get the enemy to move randomly move on his own. He’s very stiff. They have a wait cycle, but I can’t get them to move about on their own. Does anyone have any suggestions for that? I noticed there’s a python code to do it, but I can’t understand it enough to apply it to my game. I’m still very new at all this.

Also I made a sky from a sphere and applied UV mapped it. Then placed it as Static and made it cover the field. It just ends up disappearing when I hit play. It’ll render, but it won’t be in-game.

Are you using “Loc” for movement? Loc does not work well with collisions because it’s pure displacement… there’s no velocity/force involved. Use either basic Force or Servo control (search this forum for more info on Servo).

For the “waiting”, you can use states and a delay sensor. When he gets kicked, set the state to another state (like state 2) using the state actuator. In this second state, use an always sensor to play the “death” animation or whatever you’d like to do, and then a delay sensor to kill the object.

Hope that helps!

-Sam