How do I do "or" actions?

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

    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:

    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.

  • 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

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

    Just check the "Make or block"

  • 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 is the easiest way to achieve what you want if im understanding you correctly

  • Try Construct 3

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

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

  • Is this what you mean?

    https://drive.google.com/open?id=0Bx-ufu2WID53SlMzY1VNME0wQkk (click the download arrow in upper right corner of screen)

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