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

#1 2012-03-02 12:32:42

Sammysam
New Scratcher
Registered: 2012-03-02
Posts: 1

Make A Dice Roll Move your sprite round the board.

i need to move a sprite round the board with 20 squares i have made. ie. if i press the button and it changes the varible to 4 move to square four. i get there but for the second roll i cant get it right ie. if, after i have rolled a four, i roll a 2 it takes me to square 2 not 2 more sqaures!!! can anyone help me i need help quick it is homework!!!!!!!!!!! ahhhhhhhh

Offline

 

#2 2012-03-02 13:14:51

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Make A Dice Roll Move your sprite round the board.

Is the project on your account the most recent version of it?

EDIT: Wasn't sure whether to post this or not but meh:

Okay your board has 5 spaces on each side.

so you want something like:

a variable called CurrentPosition
and a DiceRoll

when someone rolls the dice the diceroll is pick random 1 to 6

On the character you now put:

Repeat (DiceRoll)
If <(CurrentPosition) < [6]>
point in direction [0 v]
else
if <(currentposition) < [11]>
point in direction [90 v]
else
if <(currentposition) < [16]>
point in direction [180 v]
else
if <(currentposition) < [21]>
point in direction [-90 v]
end
end
end
end
move [30] steps
change (currentposition) by [1]
if <(currentposition) > [20]>
change (currentposition) by [-20]
end
As this is homework preferably you'll work out a method of your own but if you do use this or something like it make sure that you understand why it works.

Last edited by Smozzick (2012-03-02 15:31:10)


http://i50.tinypic.com/ded8m.png

Offline

 

#3 2012-03-02 14:46:17

iMuffinFreak
New Scratcher
Registered: 2012-02-25
Posts: 18

Re: Make A Dice Roll Move your sprite round the board.

Sorry, Im really bad at Scratch at the mo  sad  But, I may b able to help you...

Offline

 

Board footer