4 Replies Latest reply on Aug 27, 2014 4:34 AM by eliverrang

    How to have symbols play at random intervals?

    jrkstevenson

      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!