How do I count the player’s movements?

0 favourites
  • 9 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hey guys!

    Can someone help I have such a problem if the player rests against the box and box rests against the wall, the counting of movements continues.

    What condition should be added so that movements are counted only when the player moves?

    Now it works like this:

    i.gyazo.com/ab55e8353ab08988f12d7af126dc8c81.gif

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What you're trying to do should work technically so I'm not sure what's gone wrong with your level. However for safety you don't need to use 'is moving trigger once', you know that when you simulate the player left/right in the other logic that this is a move so you can add to the variable there.

  • What you're trying to do should work technically so I'm not sure what's gone wrong with your level. However for safety you don't need to use 'is moving trigger once', you know that when you simulate the player left/right in the other logic that this is a move so you can add to the variable there.

    Thank for answer.

    But if I use such a condition

    Movements cease to be considered when the player collision with the box

    And will be counted if the player rests against the wall

  • Well you would do add 1 move and 1 push in the first block so it does count the move, anywhere you simulate the tile movement. I don't understand why it's adding the move against a wall because you are not moving if it's solid and you can't move into that space. Share the file.

  • Well you would do add 1 move and 1 push in the first block so it does count the move, anywhere you simulate the tile movement. I don't understand why it's adding the move against a wall because you are not moving if it's solid and you can't move into that space. Share the file.

    drive.google.com/open

  • So there's no problem going against the wall, I would revert back to the original logic. Looks like the bug is because it disables the solid behaviour on the blue box but enables it again in the same tick so in this time you are counted as moving.

    Try this method instead of enable/disable solid, use the grid position of the blue box as a condition and say if on pressing left and grid position of blue is not grid position of player-1 then move or add to moves etc. Another method is to use 'can move in direction' but make sure its 5 pixels or more because of what you've done with the collision boxes.

  • So there's no problem going against the wall, I would revert back to the original logic. Looks like the bug is because it disables the solid behaviour on the blue box but enables it again in the same tick so in this time you are counted as moving.

    Try this method instead of enable/disable solid, use the grid position of the blue box as a condition and say if on pressing left and grid position of blue is not grid position of player-1 then move or add to moves etc. Another method is to use 'can move in direction' but make sure its 5 pixels or more because of what you've done with the collision boxes.

    Plinkie, thank you so much.

    But could you make an example with this condition?

  • I fixed it up a bit as I realised I needed to make it suit all scenarios in the game. I've made it so it doesn't add moves if you're pushing a block or against a wall, and also sorted a bug out where you could spam keyboard presses for multiple moves.

    dropbox.com/s/mt7ns70vmkehcuo/move_push2.c3p

  • I fixed it up a bit as I realised I needed to make it suit all scenarios in the game. I've made it so it doesn't add moves if you're pushing a block or against a wall, and also sorted a bug out where you could spam keyboard presses for multiple moves.

    https://www.dropbox.com/s/mt7ns70vmkehcuo/move_push2.c3p?dl=0

    plinkie, you are awesome!

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