How do I add score by comparing the distance travelled?

  • So, the idea is the score is based on percentage...

    The layout width is 720 and for every 7.2 (since it is the 1% of 720) Layout width that is travelled by the player, the score gets added by 1%.

    I made a really tall invisible and thin pillar sprite for every 7.2 layout width, so whenever the player hits that sprite, the score gets added by 1%, which means I add 100 sprite, so whenever the player hits that sprite, the score gets added.

    It worked, but unfortunately, I noticed that when I did that, the game really lags as it is developed for mobile games & I am trying to keep the objects/sprites below 80 so the game won't cause any lag in player mobile device.

    Anyone got a solution for this?

  • I guess you could just set the score to : floor(player.x/7.2)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?

  • The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?

    haha

    Floor() is an expression, not an actual floor..

    It rounds the number down.

    0.7 will become 0

    1.2 will become 1

    etcetera

  • LittleStain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?

  • LittleStain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?

    there is not much to simplify..

    system every tick

    set score : floor(player.x/7.2)

    It's as simple as that..

  • > LittleStain haha what a shame, I didn't know it was an expression, can you simplify it by providing a screenshot or something?

    >

    there is not much to simplify..

    system every tick

    > set score : floor(player.x/7.2)

    It's as simple as that..

    Thanks, I'll try it out soon

  • The player character is flying, it doesn't run on the floor... So instead of "floor" what do I use?

    hehehehhehe you made my day ty

    just do what stain told you

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