Doubt about location

I don’t know if this is possible by default or python is needed: I’m making a pacman type game but for example, when I hit an enemy and lose a life I would like to reset the pacman position to the center but not restarting the full scene (I want to keep the points and so on where they are). Is it possible without python coding? Or do I need to? How so?

Also, is it possible to give an animation to the mouth opening and closing as the figure walks? I tried to add the node replacing the mesh but since it’s needed to close and open (2 different meshes) I don’t know how to separate them by time for example.

Thank you! :slight_smile:

Relocating is easy (even without Python):

  • setup a one keyframe location action
  • play this action for the single frame -> Your Pacman will be placed at that location

Extended version
This even works for different locations as long as there is one pose of each desired location. You get a frame to location mapping e.g.

0: (0.0, 0.0, 0.0)
1: (1.0, 0.0, 0.0)
2: (0.0, 1.0, 0.0)

Pacman animation:

  • armature deformation action
  • shape key action
  • mesh replace (not worth the effort)
  • uv-animation (needs Python / not really worth)

Can you elaborate the first step? Let’s assume I’ve my pacman going around in the scene and gets hit by an enemy (collision that will result in a message to the text displaying the lifes yet remaining, so in this case assuming I start with 3 lifes the collision with the enemy will down the total to 2) that is what I’ve so far working well, now after that event, I want to place my pacman in the center of the scene (or even any other arbitary position). Can you explain me that step by step? I’m really new into the BGE sorry. Thank you!

you place Pacman where he should be after the hit, then press “i” on the keyboard, and Location. Now you have made an Action called “PacmanAction” (if the object name of pacman is “Pacman”). (Check that you are on frame 0 or on desired frame - can change with left and right arrow keys)

Now if Pacman gets the message, he should also play an action:

message sensor --------- and controller -------- action actuator (“PacmanAction” Frame 0 to 0)

Really thankful to that. I’ll give a try as soon as I get back to it. :slight_smile: