How to get the passed value?

0 favourites
  • 5 posts
From the Asset Store
Assets for creating mountains and ravines environments
  • Tell me how to make such a condition.

    I need to get every pixel passed by the player. That is, if a player has move 100 pixels, I want to add 100 pixels to the variable.

    that is, I need to get the distance traveled by the player. How can I do that?

    In fact, I need to take away a strip of fuel when the car goes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You calculate distance from the start point to the player and that's the distance travelled in pixels : distance(start.x,start.y,player.x,player.y) assuming you are just moving in one direction, you didn't give any info about the game.

  • You calculate distance from the start point to the player and that's the distance travelled in pixels : distance(start.x,start.y,player.x,player.y) assuming you are just moving in one direction, you didn't give any info about the game.

    I need to count the number of meters passed in any direction, left, right. I can not count from the initial coordinate as the player can walk in front and back many times between this point and the distance should only be added.

  • WRS

    instead of using the start x and y in the distance calculation, use the Last x and y (and the current x,y). Every time you check the distance traveled, update the Last x and y.

    distance(lastX,lastY,player.x,player.y)

    lastX = player.x

    lastY = player.y

  • WRS

    instead of using the start x and y in the distance calculation, use the Last x and y (and the current x,y). Every time you check the distance traveled, update the Last x and y.

    distance(lastX,lastY,player.x,player.y)

    lastX = player.x

    lastY = player.y

    Big senks!!!)))

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