Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

desperately seeking help ! 1

Status
Not open for further replies.

ebony4

Technical User
Apr 23, 2004
10
GB
I am really new to director .
I would like to design a game in fact a variation similar to monopoly , so i would need to have random dice roll , random quesion apperance . I intend on using 2 players so that when one player has finished playing the other is prompted to play . can anyone tell me whether this would be too much work for a newbie . I have a week to do this challenge .
Thanks for any advice or direction in advance
 
To program this in Director, one week is well more than enough - but if you’re “newbie” as you claim then may be not(?). Perhaps you should start with simple element like “display random dice roll”. To get random number between 1 - 6, you’ll use random(6)[/color blue]. So the total of two dices is:
--
myDiceThrow = random(6) + random(6)
--[/color blue]
 
Sorry if this is a stupid question . But for using random behaviour one to six do i have to create 6 dices with different numbers from one to six ?
 
Do i have to create six different images for six dice random rolls?
 
Yes you need to create 6 graphics representing 6 faces of a dice. Then display them according to the result of random() function.
 
every time i try to create a new behavior its says

Script error : Handler dedinition expected

What am i doing wrong the code is
--
myDiceThrow = random(6) + random(6)
--

Sorry if this is a silly question as i am new to director
 
You need an event handler to invoke your script. In your case you need a button, which rolls two dices. Then attach a behaviour to this button. The following example behaviour is based upon:
- Clicking on the button will roll two dices, Dice A and Dice B
- There are 6 bitmap Cast members called “dice1” - “dice6” each representing number 1 - 6
- Dice A is displayed in Sprite 1 and Dice B is in Sprite 2
- Initially a graphic member is placed in Sprite 1 and 2 - perhaps “dice1” but can be anything
--
on mouseUp me -- this event handler invokes the script when the mouse button is up (clicked)
diceA = random(6) -- get random number for Dice A
diceB = random(6) -- get random number for Dice B
sprite(1).member = member(“dice” & diceA) -- display “dice1” - “dice6” accordingly for Dice A
sprite(2).member = member(“dice” & diceB) -- display “dice1” - “dice6” accordingly for Dice B
myDiceThrow = diceA + diceB -- the total of 2 dice rolls
end mouseUp
--[/color blue]
 
Kind thanks !
You have explained what i have been trying to find out all day
Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top