How do I restrict movement based on current location?

Get help using Construct 2

Post » Fri May 06, 2016 4:17 am

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.
B
42
S
20
G
6
Posts: 106
Reputation: 6,567

Post » Fri May 06, 2016 6:13 am

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.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Mon May 09, 2016 7:50 pm

Excellent. Thank you for the help. It got me going in the "right direction"... pun intended.
B
42
S
20
G
6
Posts: 106
Reputation: 6,567


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests