Computer Science Canada

making piece move

Author:  Jickman [ Fri May 25, 2007 2:50 pm ]
Post subject:  making piece move

hi, me and a group of people have made a monoply game, and we have encounter a problem, we don't know how to make the piece move. ok u know each game has a dice right, we want the piece move to the coresponding roll, and for some reason it won't move, and also we want the piece to bounce back.
question, can u show us how to make the piece move to the coresponding dice roll? (greatly thank u if u show us on hte program)
ps. do u also know how to make the dice go randomly and stop at number , and u can do it again ( loop statement)?
plz?

ill so thank u !! plz help XD
this program is just a sample if u can show me here =D

Author:  Jickman [ Fri May 25, 2007 9:31 pm ]
Post subject:  RE:making piece move

HELP plz =D

Author:  Expirant [ Fri May 25, 2007 9:43 pm ]
Post subject:  Re: making piece move

Wasn't sure exactly what you wanted, but I altered your dice code a little to get the circle to move to the appropriate square. Is this what you wanted to do?

code:

View.Set ("graphics:max;max")
colorback (7)
cls
Draw.Box (100, 75, maxx - 100, maxy div 2, yellow) %this is the whole board and the 10th square.
Draw.Box (100, 75, 190, maxy div 2, yellow) %square 1
Draw.Box (100, 75, 280, maxy div 2, yellow) %square 2
Draw.Box (100, 75, 370, maxy div 2, yellow) %square 3
Draw.Box (100, 75, 460, maxy div 2, yellow) %square 4
Draw.Box (100, 75, 550, maxy div 2, yellow) %square 5
Draw.Box (100, 75, 640, maxy div 2, yellow) %square 6
Draw.Box (100, 75, 730, maxy div 2, yellow) %square 7
Draw.Box (100, 75, 820, maxy div 2, yellow) %square 8
Draw.Box (100, 75, 910, maxy div 2, yellow) %square 9

color (12)
var dice : int := Rand.Int (1, 6)

put " Dice Roll:"
put dice

Draw.FillOval (50 + dice * 90, 150, 10, 10, blue)


Author:  Jickman [ Sat May 26, 2007 10:46 am ]
Post subject:  RE:making piece move

i have 1 more little question how do u make the dice display random number, and when u press a certrain letter it will stop?

Author:  CodeMonkey2000 [ Sat May 26, 2007 11:02 am ]
Post subject:  Re: making piece move

I would do something like this:
code:
var a : int
loop
    cls
    a := Rand.Int (1, 12)
    locate (1, 1)
    put a ..
    delay(100)
    exit when hasch
end loop

Author:  Jickman [ Sat May 26, 2007 12:21 pm ]
Post subject:  RE:making piece move

u know that board right, how do u might it bounce back when it gets to square 10, if u roll a number 6, and ur on square 7, how do u make it bounce back ?

Author:  CodeMonkey2000 [ Sat May 26, 2007 12:26 pm ]
Post subject:  RE:making piece move

You should check up on if statements. It's in the Turing Walkthrough


: