Restrictive Click to Move on a Grid

Get help using Construct 2

Post » Wed Jun 26, 2013 6:07 pm

So I've been doing a bit of the tutorials to get familiar with Construct 2, which is a really awesome tool - loving it.

What I'm trying to accomplish is moving a player about a hexagon grid by using the mouse as a click-to-move feature. I've got that part actually working, however, the player can move themselves freely about the map. There isn't any pathfinding or limit to their distance.

I'm trying to implement the functionality to only move to the space adjacent to the player, essentially a 1 space radius around the player.
This is a bit more confusing than I thought and it was hard to search the forums for this - I found mouse movement, but it was just point-to-point and I found grid movement, but that was using WASD or other keys.

So, the main problem is only allowing the mouse click to move the player onto an adjacent hex tile only. I went about it a few different ways and it seemed UID's were the way to go, although this got just as confusing. I think I need to use instance variables too?

https://www.dropbox.com/s/nkd170m1q9l261s/1_HexGrid_MouseClickMoving.capx

The capx should have everything in it (I made it a project, but everything should be in the layout - chess, tile - that's about it.)
Also, I was fudging it a bit just now and saw something weird where it spawns one at where it should, but then when it moves, there is another one. Not sure how that came about since I got rid of all the stuff I was trying to do, and put it back to how it was.
B
2
Posts: 2
Reputation: 154

Post » Thu Jun 27, 2013 5:19 pm

Alright, so maybe I wasn't clear in what I'm trying to. Got a lot of views, but no replies.

If you can, think Heroes of Might and Magic 2, where in a battle your troops move via hex grid. They have a limit to their movement, like the Skeleton or Peasant. So then bake that down to moving them one space at a time and that's what I'm trying to make.

I'm trying to make it so that you can only move a player piece to a neighboring grid cell using the mouse.

I tried accessing getting the UID of the player piece, so that way I can determine where it can move to. However, I was hoping there was some kind of "check for neighbors" function, because I can't figure a way to get it's neighboring tile's XY.

Is this too advanced for someone starting out with Construct 2? I can see most tutorials are for realtime movement with very few talking about turned based on a grid type movement.SonOfaSheperd2013-06-27 17:20:09
B
2
Posts: 2
Reputation: 154


Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS, korbaach, Yahoo [Bot] and 3 guests