How do I make Grid Movement?

0 favourites
  • 13 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Hi there. Grid Movement is already built into C3. This way, by default, when one button is pressed, the player moves one cell and this works great as the main control. Now, how do I get the player to move 2 cells (if I press a combination of 2 buttons at the same time).

    Many thanks!

  • You can for example set grid position to gridx+2 when moving right and if you set it to 'animate' it will move to it rather than teleport.

  • It works. Thank you very much!

    Thank you very much

  • You can for example set grid position to gridx+2 when moving right and if you set it to 'animate' it will move to it rather than teleport.

    One more question. How can I change the speed of the animation? I mean, I need to do that moovement faster.

  • There is a speed property on the tile movement behaviour that controls the speed of movement

  • There is a speed property on the tile movement behaviour that controls the speed of movement

    Ohh. I see. Thank you very much!

  • Here is a new qestion. I am truing to use behavior Tween (to move the player in a specific way) instead Set Grid Position. So how I need to set the End value to be able to moove the player over 2 cells?

    I admit that my logic is stupid but anyway, this is what I tried.

  • I guess that wouldn't work because it's looking for an x co-ordinate. Since you know the grid size you could use object.x+64 if the grid size is 32x32 for example.

  • Well this is what I tried first and it do not work properly:

    1) To see a movement of the player I need to set values like Player.X + 180, when the grid size is 30x30, and this depends also by the ease I use. Sometimes I need to put Player.X + 240 or more.

    2) The problem is that after this movement the Player is returning back to the cell where it was at the start of movement. At some other Ease for example Liniar the player is not moving in general. It means Tween is not compatible in combination with Grid Movement?

  • Not sure why you would need to alter the values, it should be player.x+2*cellsize. It's not really compatible but if you are using tween to move then it shouldn't be a problem? If you really must use tween you could drop tile movement altogether and use co-ordinates only, one or the other seems fine. Tile movement gives nice control though as you are always moving to a grid position.

  • The previous solutions would work well if the player's movements could be set (Grid Position movement / a more advanced form of tween where you can adjust any acceleration or deceleration parameter and etc).

    The movement is based on the simulation of the character's animation, ie the player's object stands still, and the movement is simulated by the animation where at the end of the animation the player is instantly teleported to where it should be if it moves without simulation (this is a solution if to use the instant change of Grid Position), at first sight this solution is a good solution but there is a problem of transition of the animations in case the player receives damage and must be stopped from moving. Respectively, a better solution would be the movement of the player as a whole, especially since there are other moments when it is necessary to move the character as a whole. The idea is that I try to make it possible that when the character, for example, moves over 2 cells and receives damage, he can be stopped on the cell where he is at the moment. At the same time I try to acquire a form of movement other than the linear one, I understand that the nonlinear movement can be simulated by the animation of the character but wuth this somehow we lack a total control. On the other hand behavior Tween does not seem to work properly in combination with Grind Movement).

    As I said End Value (PlayerX + 2 * cellsize) is not working if the player has the tile movement enabled. Respectively in this case would be a solution that when I would like to use Tween is to make Grid Movement disabled? Would that affect stability? Or would it cause the bags to appear (of course I will use movements with distances equal to x * cellsize)?

    I hope I explained a little bit of understanding.

  • Do you need tween? What is this specific way you need to move the enemy?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you need tween? What is this specific way you need to move the enemy?

    Well, after some research I think I will use Tween but with cubic() or qarp() to define my own movement instead of the "eases" available by default in Tween behavior. Also I will disable the Grid Movement while I will use Tween (in this case Tween works) I hope that will not cause bugs xD

    About the specific way I need to move the enemy: I try to give a movement trajectory with acceleration and decelleration in specific places while it will move over 1,2 or more cells. Also this will be used for weapons and so on.

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