playMaker

Author Topic: help with highscore table using arrays[Solved]  (Read 1747 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
help with highscore table using arrays[Solved]
« on: August 11, 2023, 05:13:50 PM »
I have been following along with this excellent tutorial: https://www.youtube.com/watch?v=cH2QFkUhkZ4

But I am having trouble figuring out how to use my player's score instead of using the state: Time for score and using the UI pointer click event.

What I need is for the state to run only once

My player's score is stored in a global variable but as an int, so I added the ability to convert the int back to a float, but each time the state runs; the top three possibilities are filled with the same info.

In your example, the user has to select the button and then get a new time, which is displayed correctly.

possibly you can advise me?
« Last Edit: August 16, 2023, 03:47:00 PM by colpolstudios »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help with highscore table using arrays
« Reply #1 on: August 12, 2023, 07:02:33 AM »
Hi.
As far as i can remember, the button just stops the time and set add to save.

So you could just send an event instead of listening to the button.

if you right click on a state you can set a breakpoint (this will pause the game)
set some break points so you can see step by step what's going on.
you might have set something wrong.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: help with highscore table using arrays
« Reply #2 on: August 15, 2023, 07:23:14 AM »
I used a send event instead of using the click button event.

I think your example will only work within its current scene.

If I leave the scene and return with a different score it will always be the first entry; possibly my understanding is incorrect.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help with highscore table using arrays
« Reply #3 on: August 15, 2023, 04:38:16 PM »
Hi.
yes, its not saving so it will always reset, but you can load/save the arrays, then it should work

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: help with highscore table using arrays
« Reply #4 on: August 15, 2023, 05:32:14 PM »
Thanks for your answer ill give it a try; however, in the meantime, I've redesigned the way I was doing things with a copy of three scenes all put together within a single scene with a state that will eventually hold your fsm.

I accidentally deleted the one I had :( and then I saved :( :(


colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: help with highscore table using arrays
« Reply #5 on: August 16, 2023, 03:46:24 PM »
Hi, in order to save and load I'm using the custom action Json Save/Load.

The start state uses the loading and when Finished goes to the "DisplayScore" state.

Added a new state "Save the arrays" It's placed between the "Set score" state and "Display Score" state.

That has fixed the issue:


« Last Edit: August 17, 2023, 04:05:21 PM by colpolstudios »