SOLVED: Condition and Event for Dice view

Started by barefoot, Fri 09/04/2010 12:24:37

Previous topic - Next topic

barefoot

Hi

Scenerio:

you roll a Dice. The Dice can show numbers 0 to 6. What I would like to do is set an Event for each View that the Dice (Object) stops at (7 Events in total).

IE.
if object frame 0 do this
if object frame 1 do this
etc etc


So far I have this CODE that works (except Frame 4 is actually 5 on the dice)

The Dice actions of start and stop are controlled by Text Hotspots.

Code: ags

function hHotspot6_Interact()
{
odice.SetView(16);
odice.Animate(0, 1,  eRepeat, eNoBlock);
}


function hHotspot7_Interact()
{
  if (object[2].Animating) {
  object[2].StopAnimating();
  
  Display("You have rolled a %d", odice.Frame);
  }
  
    if (object[2].Frame>4)
  Display("weldone");
}


The Object is named odice

Any help would be appreciated

barefoot




I May Not Be Perfect but I Have A Big Heart ..

Crimson Wizard

So... to me it sounds like you already know how to do this... unless I am missing something.
You need to make something happen if Dice rolls certain number(s)?
Or, if Dice is clicked while showing certain number?

barefoot

Yes Crimson, when dice has stopped and shows a number.

but you know me.....lol

need to continue adding the if Functions... (braces)

Code: ags

 }
  
    if (object[2].Frame>4)
  Display("weldone");
}


I think you know what i mean..

cheers

barefoot
I May Not Be Perfect but I Have A Big Heart ..

Crimson Wizard

Hmm... okay.

Code: ags

if (object[2].Frame>4)
  Display("weldone");

if (object[2].Frame == 0)
{
 // do something
}
else if (object[2].Frame == 1)
{
 // do something
} 
else if (object[2].Frame == 2)
{
 // do something
}

... etc etc


Is that it?  ;)

barefoot

Many thanks Wizard ol' chap..

works a treat  ;)

cheers

barefoot
I May Not Be Perfect but I Have A Big Heart ..

Khris


barefoot

#6
Quote from: Khris on Fri 09/04/2010 14:18:58
Soo.... it's a seven sided die?

yes Khris, funny i know... but Dice has  0...  but i suppose its more of a 'Numbers' animation rather that a dice..  But can have many other uses..

barefoot
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk