case statements for actions?

0 favourites
  • 3 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • 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!

  • 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..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)