Rotate a character when another character's back is turned?

I have a game where there’s a final battle on a ring. I am using pathfinding for the computer to find the player. How do I get the computer to flip when it changes directions?

What kind of game are we talking about? It is a top down kind of game, or it is 3/4 view (like nes/snes Zelda)

It’s a 2d fighting game with stick figure like characters. I’m trying to get the computer to turn when the player jumps over them.

An easy way to do it is to test for the X position of both, Player and PC.

If the sprites are looking right by default, then:

 + If Player.X() < Pc.X() Trigger Once then PC switch horizontally: yes. Player switch horizontally: no
 + If Pc.X() < Player.X() Trigger Once then PC switch horizontally: no Player switch horizontally: yes.

This way, depending of the relative position, they will face the opponent.

1 Like

It doesn’t work. It only causes the computer character to face one direction.

Possible mixed the events, but I have just test them:

I don’t need the player to rotate, just the computer character. It’s a battle and the walk to the left when it starts. It still won’t work.

To confirm :

  • You are testing battle5 scene?
  • Are there any other events that occur after those in the screen snip that change the repear by flipping horizontally?
  • Is there only 1 instance of player in the scene (easy way to determine this is to start in debugger and see how many instances of player there are)

Because as it stands, that code should wrok.

The only other times the player will flip is when turning direction. The reaper character only flips during this part.

Can you provide the screen snip for that?

I decided to do a screen record because that’d be a lot of screenshots. Here you go.

Nice idea.

I can’t see any horizontal flipping events of reaper in the video, including the 2 events you screen snipped earlier. If this is the code you’re running, then it’s correct that reaper doesn’t tun around

1 Like