distance counter

0 favourites
  • 8 posts
From the Asset Store
Make a displayed number gradually increase or decrease, making an impression of a real-time counting.
  • Hello friends

    in platform game im fly from left to right layout(very long layout- 30 000 pixels ;p width). How do a distance counter?


  • What is the problem ? 30000 is not a great number for a computer !

    You can display the distance in percent XX.XX% as 3 px = 0.01% of total width, ... i don't know your layout "height" but it can more easiest for you to manage the screen display in C2 to cut this layout in 10-20 "rows" to shorter the width and increase the height instead and use scroll system when you reach the right side of the layout "row" to move to left side of row+1.

  • You can measure the distance between two points with the expression:

    "distance(x1, y1, x2, y2)"

    At the beginning of your flight have the system to create an Object:Sprite, and when you need to measure the distance, measure it from this Object to your Players hitbox (or similar).

    If you've chopped up your layout into seveal wide layout screens as the user above has mentioned. So that your player wraps at X=??? and is repositioned to X=0 at a greated Y value. Then calculate your distance as previously suggested but also add on the layout width multiplied by how many times you've wrapped.

  • You don't tell a lot about your game, so I'm not sure if you want the distance from a starting point or the distance travelled, which might be quite different if the player can go back and forth.

    Here is an example that uses an 8-direction behavior for the spaceship, but automatically flies to the right by simulating the right control.

    For the distance displayed, the spaceship saves off its starting point and then every tick calculates the distance it has gone from the starting point.


  • Another thing don't forget you can now load a tiledbackground from url so create or load your levels during the game and not have load all 30000 px full detail background before the game start !. So if you cut your layout in 10 rows there is probably no interest when player is in row 1 to have row 3-10 loaded in memory ! ... you can load row 3 only when player reach row 2 and so on.

  • kittiewan i think your tips are closest to what I need :)

  • Your welcome, Delgado.

    naelian - Have you tried loading tiled backgrounds on the fly yet? I have a project in mind where it might be useful, but haven't sat down to try it out yet. I could go from having many layouts to just having one endless one. Awesome!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • kittiewan Yes i used it in my Compan360 project ... i ref the 7mb 360? tiledbackground from Ockley in project using the import features, and then i loaded it in runtime from local project dir with "./tlbg.png". . So for a big adventure game with 100-200 scenes you can keep in memory only the scene where the player can go in one or two "moves" and not load all the 200 scenes before the project start !

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