[SOLVED]How do I make a fastest lap's ghost in racing game?

0 favourites
  • 7 posts
From the Asset Store
Top Down Racing Game Pixel Artwork for any kind of racing game you can imagine.
  • Hi to everybody!....and sorry for my poor english...

    I apologize because there is anoter thread similar to this one, I know.... i've posted there too. But nobody can't (or want

    I'm making a 2d racing game and i want to implement this feature. I've understanded (partially) the example and the use of array for this (thanks a lot!) and now i can record and playback only a single lap.

    I'll try to explain better: when I finish a lap and my car is running another lap, I must stop to "record" to make possible to retrieve the values previously stored, so i can't record actual lap with a single array.

    Partially I solved using two arrays, when one is recording the other one is "playing", but I believe it's not the right way.

    Now my problem is that I am not able to playback the values stored in array only if current lap is faster than best lap.

    I hope you can understand my problem, but mostly I hope you can help me!

    Tanks!!!!

  • not quite sure, But look up mario level record. I think that will have what you are looking for.

  • "Two arrays" is indeed the right way to do it. You also need to have variables to compare the best lap time vs the current lap time when you pass the finish line. If current time is less than the best time, then copy the "recording" array onto the "playback" array. An easy way to do it is to use PlaybackArray.Load(RecordArray.AsJSON), and then you can reset the RecordArray and start recording anew.

  • Thanks for the replies!

    In the past I've tried to copy the values stored in recording array in a third array, than after comparing current lap time with best lap time, copying the values of third array in the playback one....but it seemed not working. But, at this point, surely for my ignorance in the use of arrays...

    Now i'll give a try to the solution posted by Magistross(thank you!).

    If i'll succed i'll publish on this post a guide for other noobs as me.

    Thanks again to this beautiful comunity!!!

  • Finally I've managed to create a working ghost lap thanks to the suggestion of Magistross! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    As I promised, I've created an example to share:

    dropbox.com/s/sfg5mk5upvjvb ... .capx?dl=0

    I don't know if the link it's working, because it's the first time i share a dropbox link from pc. Tell me if it's a bad link, than i'll provide.

    Surely it's not the best way, but it works!

    Thanks to all, but mostly to Magistross!

    ciao a tutti!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry, my reputation is under 250, so I can't share a link...

    I don't know if in this way is working but I'll try.....

    put www dropbox com before

    /s/sfg5mk5upvjvbw5/ghost%20example.capx?dl=0

    Sorry!

  • It's working! Good job learning some new tricks.

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