Forum rules - please read before posting.

Halting 2D player character movement on Runtime

I'm integrating Adventure Creator with the Intrigues and Character Creator 2d plugins (available from the Unity Asset store) and have a 2D player character movement issue.

I'm using Adventure Creator's 2D navmesh and player character system. The player character uses Character Creator 2D sprites and animation (simple Unity four direction 2D movement).

The Intrigues plugin allows the player to open a page menu when an icon is clicked.

When clicking on an Intrigues map icon, I can prevent the player character from moving on the map (most of the time) by targeting Game Engine -> kickstarter.TurnOffAC in On Page Opened, as shown:

This works perfectly when the character isn't moving, but has inconsistent results if the player character CharacterCreator2D sprite is moving within the Adventure Creator NavMesh when the icon is clicked. The character keeps moving tot he clicked destination:

I've tested disabling obvious AC GameEngine boolean options within On Page Opened, such as PlayerMovement, PlayerInteraction, and NavigationManager, but none halt or pause the player character's movement on the NavMesh in the same way as the 'turn off AC' kickstarter.

Any advice on alternative methods to halt or freeze player character movement is appreciated, thank you.

Comments

  • Welcome to the community, @jamesdillon.

    You can halt the Player by calling the Player component's Halt function.

    This can be called through code with:

    AC.KickStater.player.Halt ();
    

    Since the Player is spawned/assigned at runtime, however, you can't assign this in a Unity Event Inspector.

    What you can do, however, is run an ActionList asset that halts the Player instead.

    If you create an ActionList asset that runs a Character: Move along path Action, check Is Player? and set its Method to Stop Moving. Then have your Unity Event run this asset's Interact function.

    If you want to also disable other AC systems (e.g. Movement and Interaction, to prevent the Player from being able to move while the page is open), you can then also add an Engine: Manage systems Action.

  • Thank you Chris, I will work with your advice. Much appreciated.

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.