How do I do "or" actions?

Get help using Construct 2

Post » Fri May 01, 2015 7:34 am

Let's think that we have a Family that is full of objects that will appear on screen randomly. Every 5 second the game will choose one random object from that family and spawn it to the screen.
This is how it happens:
Image

Most of those objects are player enemies. Now I have made rule where when any of them touches the weak point of player, it will reduce life from HealthBar

This is how it happens:
Image

Now the problem. When I said that the family includes mostly "enemies", I did not tell, that the family also includes health crates and coins that you can collect for score. The logical follow for that is that if a player jumps to the health crate with his weak point, he actually loses health and very fast he will have almost all of it back (but not all, because he touched the family member with the weak point of player).
This same happens with coins. Player loses health and has score bonus.

The weak point is one very simple invisible object that is pinned to player and if anything overlaps it, it will remove health from player.

So i need to do a family for Coins and Health Crates, but the problem is that i don't know how do i fix the first event for being like:

System - Every 5 seconds
System - Pick a random Spawner instance
------
Spawner - Spawn PhysicsObjects on layer 2
OR
Spawner - Spawn PhysicsObjects2 on layer 2

Now I know that I can do OR-events, but I have no idea how to do OR-actions?

Edit: Ok, there is a little problem with this i notices after i wrote this text. It would spawn too often the health and coin stuff, because of that rule it will choose average 50 % of time the PhysicsObjects2. But i have no idea how to do it differently. I cannot left them into the PhysicsObjects -Family, because then they will reduce life from player and will create "pain" -particles when touching player. Also if they are in some other family, they will mess up my spawning events (and lot of other stuff), because they would appear then at the same time with the other objects.
B
11
S
1
Posts: 63
Reputation: 658

Post » Fri May 01, 2015 7:47 am

Have an event that first picks a random spawner.
Then that spawner fires off its spawner code for whatever type it is.

If you need or want less chance for one or more types then use a random (choose) with results like:
1 - 5 spawner1
6,7,8 spawner2
9,10 spawner3
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333

Post » Fri May 01, 2015 7:53 am

For the "or" action, you need to do a right click on your event/condition. You will have this menu :
Image

Just check the "Make or block" :)
B
3
Posts: 2
Reputation: 179

Post » Fri May 01, 2015 8:04 am

@MrTrax0s that is how you make a or conditions it is not possible to make a or action.

@sorbias maybe you worded you question oddly but you are only able to create or Conditions it is not possible to create or actions as actions are activated by conditions. the first reply by @chrisinfinger is the easiest way to achieve what you want if im understanding you correctly
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Sat May 02, 2015 1:45 pm

@volkiller730 I maybe wrote my question very oddly. That's best English I can write and i know it has some limits. (i'm not native English speaker)

Maybe "or" is wrong definition for what I tried to achieve. Maybe "choose one of these actions at time" would explain it better.
I'm not sure if I understood correctly @chrisinfinger 's explanation for solving this problem.

I have something like 10 spawners, that must be able to spawn any kind of an object. It's Double random:
First pick random spawner, then pick random object to spawn from that random spawner.
B
11
S
1
Posts: 63
Reputation: 658

Post » Sat May 02, 2015 8:20 pm

Is this what you mean?

https://drive.google.com/open?id=0Bx-ufu2WID53SlMzY1VNME0wQkk (click the download arrow in upper right corner of screen)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333


Return to How do I....?

Who is online

Users browsing this forum: part12studios, Yahoo [Bot] and 9 guests