MalcolmTheGuy's Recent Forum Activity

  • Yeah you can make global variables that hold the values and then you can access them through all event sheets...

    To make a global variable right click in the event sheet and the option to make on should show up

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could create an invisible sprite (I'll pretend it's called "InvisibleSprite") and put it at various points in the map. The more you put in the better because then when you want to get the enemies to run away from the player use an event like this:

    By the way this is for a scenario like pacman, but if it was a bit more open world and you want them to run straight away from you there are much easier ways to do this.

    Also make sure the enemies have pathfinder and give the invisible sprite an instance variable with initial value of 0... I'm going to pretend the instance variable is called "tracking".

    Conditions:

    System -> Every Tick

    Player -> (whatever you use to indicate when the enemies will run away from the player)

    InvisibleSprite -> Pick Nearest/Furthest -> Which: furthest

    X: Player.X

    Y: Player.Y

    Actions:

    InvisibleSprite -> Set Value -> Instance Variable: tracking

    Value: 1

    After this event make another that is like the following:

    Conditions:

    System -> Every Tick

    Player -> (whatever you use to indicate when the enemies will run away from the player)

    Actions

    Enemy -> Find Path -> X: InvisibleSprite.tracking = 1 ? InvisibleSprite.X : Player.X

    Y: InvisibleSprite.tracking = 1 ? InvisibleSprite.Y : Player.Y

    InvisibleSprite -> Set Value -> Instance Variable: tracking

    Value: InvisibleSprite.tracking = 1 ? 0 : Self.tracking

    And finally do one more event like this:

    Conditions:

    Enemy -> On path found

    Actions:

    Enemy -> Move along path

    That should do it, if it doesn't work either reply to this comment or private message me and I'll find another way to do it or figure out where you went wrong.

    -Malcolmtheguy

MalcolmTheGuy's avatar

MalcolmTheGuy

Member since 20 Feb, 2016

None one is following MalcolmTheGuy yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies