TinyDB high score not updating properly

This is a pong game. I have implemented two screens, one for playing the game itself, and the other to reflect game over with the score, and high score.

Problem is that the high score does not save properly. For example, if I were to score 4 in the first try, and score 2 score second on the second try, it would reflect my high score as 2.

Screen 1

Screen 2

Does this help ?

That was for another problem :sob:

Where is the place that you load global high_score from the saved high score in TinyDB?

Hi, I managed to solve the problem by instead of using another screen and tinyDB, I used a another overlay and made it visible after the game ends.

I have another unrelated question which is how can I make image sprites:

  • Appear for a few seconds and then reappear but at a different part of the canvas
  • Disappear once the ball hits it

That could work.
Who cares about yesterday's high score, anyway?

That sounds like the Mole Mash tutorial.
Have you done that yet?

Thanks, I'll checkout some mole mash tutorials.

I'm trying to implement a 4 second countdown timer (Shows different images every second - 3, 2, 1, Go) before my game begins, which would be activated when the start button is pressed. It doesn't seem to work though.


Rename Clock1 to CountdownClock in the Designer, to make it single purpose, and set it to Enabled=false. You will start it in the Click event, after setting it up to start fresh.

You can add more Clocks later for other purposes.

You don't need those two variables (timer and timer_start) if you work from the CountdownNumber Picture value in CountdownClock Timer, and initialize it in the ButtonStart.Click event.

That Ball1 initialization code has to move from the Click event to the bottom of the
CountdownClock Timer if/then/else tree, to make it only run after the Timer has cycled all the way through.

I don't really understand, but something like this?

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

Project1.aia (2.6 MB)

See those little :x: marks. You most probably accidendly deleted the global variable timer_start

Try this one, countdown also works

Project1a.aia (2.6 MB)

Wow, I never thought of using the "join" block this way. Thanks!

1 Like

Since the images you used for countdown was in the form of 3.png, 2.png .... it was easy to do it :slight_smile: Otherwise I would have use if ... then statements ...

I have added a star which, whenever hit by the ball, it adds 5 points. However, I have noticed that the ball hits the left and right edges of the screen quite excessively. How can I fix this?

Look for the event block that fires when you hit an edge.
There is a bounce block that works well with that event block.

Do you know how to fix this? The StarFirework image sprite and StarHit sound do not show up and play when the ball collides with the star.