How do I restrict movement based on current location?

0 favourites
  • 3 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • I am very new to Construct and I have read the manual and done some tutorials. I am needing some guidance with a project I want to develop. It seems like it should be straight forward, but I cannot think of which events and actions to pursue.

    I am wanting to develop a wall-free maze type game that allows the player to move depending on the rules of their current position. It seems to make sense that the player events should contain the logic for the movement restrictions. Something like when “player is overlapping square1”.

    How do I restrict the “jump to position” straight-line choices to only ones that are allowed by what type of square the player is standing on? Like left/right only or up/down/left/right or just the blue options.

    Just like any maze I want to the player to only move to the next allowable position without jumping anywhere they want. With the player essentially carrying the maze rules, additional levels would just be an arrangement of blocks that the player knows how to interact with.

    Any suggestions would be appreciated.

  • A logically simple option would be to use invisible placeholder sprites, with rules in boolean instance variables for each direction - up down left right, either true or false

    Your base condition is

    Player is overlapping sprite

    Sub events

    On Right Key pressed

    Sprite.right is true | Move Right

    On Up Key pressed

    Sprite.Upis true | Move Up

    Basically, while on this sprite, if the sprite allows me to move in the direction I specify, then move.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Excellent. Thank you for the help. It got me going in the "right direction"... pun intended.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)