Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

How to have symbols play at random intervals?

$
0
0

Hello all,

 

I'm trying to create a "whack a mole" like game in Edge Animate, and was wondering if there was a way to have the "hamsters" pop up at random intervals?

So far my script looks like:

 

sym.setVariable("score", 0);

var score = sym.getVariable("score");

sym.$("score").html(score);

 

sym.getSymbol("Hole_1").$("Hamster").click(function(){

  var score = sym.getVariable("score");

  sym.setVariable("score", score + 5);

  sym.$("score").html(score + 5);

  sym.getSymbol("Hole_1").play("cured");

});

 

Such that I have a symbol called hole which has a hamster that pop ups, when you click the hamster it plays the "cured" animation and adds 5 points to the score.

 

Thanks!


Viewing all articles
Browse latest Browse all 9897

Trending Articles