Does anyone know how to create a timer or score keeping function in the sprite lab, app lab or game lab? We have been looking around and don’t seem to find the answer.
There are a few different ways to use a timer - and countless ways to “keep a score”. If you have a specific problem you are working on, perhaps I can help point you in the right direction, but if you just need more info, I suggest checking out this post: How to design and code a Timer in AppLab?
That should give you some ideas! In particular, I always like the examples!
Okay . . .thanks for the information . . . but now my students are asking for help in sprite lab to make a timer or keep score. Is that possible?
I was not able to find any documentation to create a timer in Sprite Lab. But, you can do it in AppLab and GameLab. Here is a post on the forum that explains how to make a timer in GameLab. @Katie has already shared a link for AppLab.
Too bad!! My students are working with the sprite lab and were hoping to get some help. They have also tried looking on the internet and there seems to be nothing.
Well, if you think of something . . . any suggestion would be appreciated!
I’m not familiar with all the mechanics of sprite lab, but you can apply the basic principles of score keeping from the Game Lab lessons in CS Discoveries.
Here’s an example I made: https://studio.code.org/projects/spritelab/1_87sl9JGaSOZFf0p9rDLCejzyS-YfnUgjrhFhDCSRA
Click the sprite to increase the score.
I wasn’t sure how to display the numbers, so all I could find was a “title” block. It also seems to register a click as continuously repeating clicks, so not the behavior I was going for. Nonetheless, there’s the skeleton of a scorekeeping algorithm which is to initiate a variable with a value of 0, then on some event, increase the value of that variable by some number.
As for timing, there does not appear to be any functions specifically for timing. The only possible chance might be to do something hack-y like have something loop thousands of times in order to create a pause or use some other action that takes a finite amount of time (like a sprite movement maybe).