Hello, I want to do a score which goes over several scenes i tried it with these java scripts but it did not work these numbers should also be variables. For example i tried that one:
If you want to take a closer look here is the share link:
your script works! However, in your “PlayerLives” Blockly tab in Scene 1 you run a while loop without pausing in-between the steps. This means that when you start Scene1 you switch to Scene 2 very quickly and before the property could be saved in the space.
Try adding a pause block as shown below in your “PlayerLives” coding tab in Scene 1.
Hope this helps!
If I want to set the variable to a random number what do I have to do, so a number which we know when the scene is changing first? Do I have to call the number “X” then ?
can you share a link to your space with us? You can do so by pressing the “Share” button in the toolbar, then copy-pasting it here.
Hi @Stefan ,
Here is the link https://cospac.es/iIud
remember the value of the variable should be depending on the playful power this is just a version where I am trying to make the score
Space.setProperty method you set the property “Time” to the string “Final Time”. Remember that the first parameter of the method is the property-name, while the second is the value you are assigning to it. In your code, you’re doing it the other way around.
To make sure that you’re not mistaking variable names for strings, you can also write your “Time” and “Lives” variables in lowercase as “time” and “lives”.
Below is the correct version of your script. Notice how I re-named the variable names to be lowercase, and don’t use the ’ ’ - symbols around the variable.
Click to see solution
In this scene, make sure you assign a value to “lives” and “time” before giving it another value by script.