Forum rules - please read before posting.

Keep a player moving in one direction while still able to control

Hello. I wish to achieve the effect that, in a minigame, the player will automatically keep running to the left. While at the same time, it is still possible to control the player to move up and down to avoid obstacles.

I know it can be done using Unity scripts beyond the AC system. But is it possible to achieve the effect by AC?

Comments

  • If your "Movement method" is set to "Direct", then moving left is a case of invoking the Horizontal input with a negative value.

    AC's SimulateInputAxis function, if called in an Update loop, could feasibly move the character automatically if its used to simulate this input:

    AC.KickStarter.playerInput.SimulateInputAxis ("Horizontal", -1f);
    
  • Thanks, the simulate input function is very powerful! But when I press the right input, the horizontal axis will become 0 and character not moving, I tried AC.KickStarter.playerInput.SimulateInputAxis ("Horizontal", -10f); without success.

    Any idea how to counter the the right input effect or disable the right input?

  • As your original post mentioned moving to the left, my example code used "-1f", which causes leftward movement. For right movement, use "1f" instead.

    Note that if you try to invoke the Horizontal input button manually (i.e. via a keypress) at the same time as simulating, you'll get a conflict meaning one of the commands will be ignored.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!