This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-20 20:00:58

Niani
New Scratcher
Registered: 2012-03-23
Posts: 1

I need help trying to use a dice

I am trying to make a game show and in order to do this I need to create a type of dice. But I need to make the sprite move as many times as the dice's number. Is it possible to do this and if it is how can I do that

Offline

 

#2 2012-04-20 20:21:38

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: I need help trying to use a dice

Create a die sprite with 6 costumes.
Have the first costume show the die's first side (one dot), the second costume show the die's second side (two dots), and so forth.
When you need the die to be rolled, use this script:

when I receive [rolldie v]
switch to costume (pick random (1) to (6))
broadcast [movesprite v]
This will generate a random number from 1 to 6, and the die will display that number.

Then, in the sprite that must be moved:
when I receive [movesprite v]
go to x: ( ([costume # v] of [die v]) * (10) ) y: (y position)
This will move the sprite the number of steps displayed on the die, multiplied by 10.
Replace the '10' with any value.


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-04-21 00:44:39

jsboygenius
New Scratcher
Registered: 2012-04-21
Posts: 4

Re: I need help trying to use a dice

BTW, if you want a good die costume and random rolling sequence, I have made a project titled Rolling Die! that might be able to help you.

Offline

 

Board footer