0 Favourites

case statements for actions?

  • hey all,

    noob to c2 here.. just wondering if there is some way to do this:

    when the player shoots a rock, the rock explodes and sometimes either gold, silver or bronze pieces appear (all different sprites).

    I first check a random number (1,20) and compare with a constant (10, let's say)

               if Rand = Constant then spawn object (which works for one object)

    but I need:

               case Rand:

                        

                      ConstantA: then spawn objectA

                      ConstantB: then spawn objectB

                      ConstantC: then spawn objectC

                      ConstantD: then spawn objectD

                end case

    Thanks!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • system compare two values - rand = contanta - spawn object a

    system compare two values - rand = contantb - spawn object b

    etc

    Set these as subevents of the event that sets the random number and you should be good to go..

  • aaaaahhh.. I saw sub-events in the manual, but thought you just dragged it until you got the >--- and when I tried to drag another event up there it didn't give me the >----

    looks like I have to right-click to add it.. nice..

    THANKS! I appreciate it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)