How do I make this grid movement?

0 favourites
  • 2 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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