Two Questions on randomness

  • I have an idea that I plan to implement on an enemy. So, there's an invisible object that is pinned to be in front of the enemy. I want the enemy to react two possible ways when the player does an attack whilst overlapping the invisible object, so how do I make it randomly do one action or the other?

    The second question is that when the enemy dies, how do I make it randomly spawn one of three different objects?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Basil,

    There is a few different ways you can tackle this but the concept is you have a variable (either a global, local or an instance variable built into the object).

    On collision or overlap, you want to "Set a value" for this variable and add in the randomise part. Eg : Choose (1,2).

    Now you make 2 seperate sub-events (events that are directly below and indented) and "Compare variable"

              Variable = 1 -> Do this

              Variable = 2 -> Do that.

    If that doesnt make sense yet have a closer look at the manual (there is also a ton of examples just use the search function).

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