Two Questions on randomness

Get help using Construct 2

Post » Sat Apr 13, 2013 1:31 am

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?
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sat Apr 13, 2013 1:44 am

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).GenkiGenga2013-04-13 01:47:04
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, zenox98 and 24 guests