Hello.
I need help. How can I get the score to accumulate on a random number?
Here is the code below:
[[start]]:
@set p1_score = 0
getRndInteger = function(min,max){
return Math.floor(Math.random()*max)+min;
};
Hello.
var rndInt = getRndInteger(0,2);
set("int",rndInt);
Your random integer is: {int}.
Player 1's Score: {p1_score}
{RESULT}
[[RESULT]]:
{if int=0: {RES00} }
{if int=1: {RES01} }
[[RES00]]:
You missed the shot.
[[RES01]]:
@inc p1_score 2
You made a two pointer.
Something like this?
[[start]]:
getRndInteger = function(min,max){
return Math.floor(Math.random()*max)+min;
};
@set p1_score=0
Hello.
[get a random integer]
Player 1's Score: {p1_score}
[get a random integer]:
var rndInt = getRndInteger(0,2);
set("int",rndInt);
Your random integer is: {int}.
{if int=0: {RES00} }
{if int=1: {RES01} }
[[RES00]]:
You missed the shot.
[[RES01]]:
{@p1_score+=2}
You made a two pointer.
Player 1's Score: {p1_score}