Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » dice roll
- BaconBoy672
-
Scratcher
25 posts
dice roll
Hello!
Me and my friends @JLDScratch25, @rytygames_1 and @oofboyz9 are building a pawn game and need to know how to create a script that knows which players turn it is. Can you please help by showing me the script using the

Me and my friends @JLDScratch25, @rytygames_1 and @oofboyz9 are building a pawn game and need to know how to create a script that knows which players turn it is. Can you please help by showing me the script using the
say [Scratch blocks mod?]Thanks so much

Last edited by BaconBoy672 (March 1, 2022 15:45:44)
- Zippy0426
-
Scratcher
99 posts
dice roll
in the code that allows the player(s) to move their respective chess peice, set a variable known as “Turn” to the apposing team
for example
for example
when flag clicked
forever
if <(Turn) = [1]> then
wait until <<touching [mouse-pointer v] ?> and <mouse down?>>
set [Turn v] to [2]
end
end
Last edited by Zippy0426 (March 1, 2022 14:19:27)
- lion334
-
Scratcher
100+ posts
dice roll
Hello!Hi, this is lion334
Me and my friends @JLDScratch25 and @oofboyz9 are building a pawn game and need to know how to create a script that knows which players turn it is. Can you please help by showing me the script using thesay [Scratch blocks mod?]Thanks so much
I'd make a Sprite called “dice” and make it have 6 Costumes with each having the Numbers from 1 to 6 on it AND (important) the Costumes must be numbered from 1 to 6, but not “Costume1, Costume 2, etc…” it needs to be “1, 2, 3, 4, 5, 6”.
Then, do this:
when I receive [DiceRoll]
go to x: (0) y: (0)
set size to (100) %
show
repeat (pick random (6) to (10))
next costume
wait (0.1) secs
end
repeat (pick random (4) to (7))
next costume
wait (0.4) secs
end
repeat (pick random (3) to (5))
next costume
wait (0.7) secs
end
wait (2) secs
set [dice-rolled] to ((costume #))
hide
That way you have a neat animation for the dice, and the dice outputs a random number from 1 to 6.
You could also make it with no dice roll:
when I receive [DiceRoll]
set [dice-rolled] to (pick random (1) to (6))
But that would be lame wouldn't it?
Sincerely, lion334
- lion334
-
Scratcher
100+ posts
dice roll
Just realized am loster than lost. Sorry for making an answer on dice-rolling and not on how to make a turn-based game :cHello!Hi, this is lion334
Me and my friends @JLDScratch25 and @oofboyz9 are building a pawn game and need to know how to create a script that knows which players turn it is. Can you please help by showing me the script using thesay [Scratch blocks mod?]Thanks so much
I'd make a Sprite called “dice” and make it have 6 Costumes with each having the Numbers from 1 to 6 on it AND (important) the Costumes must be numbered from 1 to 6, but not “Costume1, Costume 2, etc…” it needs to be “1, 2, 3, 4, 5, 6”.
Then, do this:when I receive [DiceRoll]
go to x: (0) y: (0)
set size to (100) %
show
repeat (pick random (6) to (10))
next costume
wait (0.1) secs
end
repeat (pick random (4) to (7))
next costume
wait (0.4) secs
end
repeat (pick random (3) to (5))
next costume
wait (0.7) secs
end
wait (2) secs
set [dice-rolled] to ((costume #))
hide
That way you have a neat animation for the dice, and the dice outputs a random number from 1 to 6.
You could also make it with no dice roll:when I receive [DiceRoll]
set [dice-rolled] to (pick random (1) to (6))
But that would be lame wouldn't it?
Sincerely, lion334
- BaconBoy672
-
Scratcher
25 posts
dice roll
in the code that allows the player(s) to move their respective chess peice, set a variable known as “Turn” to the apposing teamawesome, thanks.
for examplewhen flag clicked
forever
if <(Turn) = [1]> then
wait until <<touching [mouse-pointer v] ?> and <mouse down?>>
set [Turn v] to [2]
end
end
- BaconBoy672
-
Scratcher
25 posts
dice roll
It's fine, I was having trouble with an animation as well, so thanks!Just realized am loster than lost. Sorry for making an answer on dice-rolling and not on how to make a turn-based game :cHello!Hi, this is lion334
Me and my friends @JLDScratch25 and @oofboyz9 are building a pawn game and need to know how to create a script that knows which players turn it is. Can you please help by showing me the script using thesay [Scratch blocks mod?]Thanks so much
I'd make a Sprite called “dice” and make it have 6 Costumes with each having the Numbers from 1 to 6 on it AND (important) the Costumes must be numbered from 1 to 6, but not “Costume1, Costume 2, etc…” it needs to be “1, 2, 3, 4, 5, 6”.
Then, do this:when I receive [DiceRoll]
go to x: (0) y: (0)
set size to (100) %
show
repeat (pick random (6) to (10))
next costume
wait (0.1) secs
end
repeat (pick random (4) to (7))
next costume
wait (0.4) secs
end
repeat (pick random (3) to (5))
next costume
wait (0.7) secs
end
wait (2) secs
set [dice-rolled] to ((costume #))
hide
That way you have a neat animation for the dice, and the dice outputs a random number from 1 to 6.
You could also make it with no dice roll:when I receive [DiceRoll]
set [dice-rolled] to (pick random (1) to (6))
But that would be lame wouldn't it?
Sincerely, lion334
- Discussion Forums
- » Help with Scripts
-
» dice roll


