How do I make this grid movement?

Just started using Construct 2? Post your questions here

Post » Tue Feb 03, 2015 6:01 pm

Hi, I have been following the "Small Tactics" tutorial by @Kyatric, and come up with a puzzle game that will use simmilar mechanics to move around. But a little bit different, and im lost how to do it. I would like to only be able to move in 4 directions, not 8 (or 9 if you include standing still) like now in "Small Tactics". How do I tweak it so that I can only move either up, down, left or right?

Capex file is here - http://cdn.tutsplus.com/gamedev/uploads ... Source.zip

Also I would like to be able to block the piece, im lost how to do that as well.
Like in the attached image, I have numberd the grid to help explain. And where I put the red lines on the grid I would like to prevent the pieces from crossing. So going from 6 to 9 or vice versa is not possible and going between 1 and 2 is also not possible. Any idea how to do that?
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 1
Reputation: 214

Post » Tue Feb 03, 2015 7:48 pm

You have to modify the "CheckMove" function and make it so it will only check the cells in X0, Y-1; X-1, Y0; X0, Y0; X1, Y0; X1,Y1 are tested for collisions and will create the GhostPiece object that allows for movement.

For your blocked pieces question I'm not sure what exactly the algorithm would need to be, but it probably would need to be checked in that function as well.
If I remember correctly I explain the reasoning behind the "CheckMove" function as it is, and if you review it, you should be able to modify it according to what you are looking for by modifying the conditions/algorithm.
New to Construct ? Where to start



Image Image

Image Image



Please attach a capx to any help request or bug report !
Moderator
B
262
S
93
G
55
Posts: 7,145
Reputation: 67,059


Return to Beginner's Questions

Who is online

Users browsing this forum: ramyaswetha and 0 guests