Combining And and Or blocks?

0 favourites
  • 6 posts
From the Asset Store
25 high quality isometric ground blocks + sprite sheet
  • Hello people,

    I'm currently on day 1 of a 3 day game jam, and I have a little problem with the event sheet.

    I have a system where you loose one Cookie (point) when you hit something. I have a geiser, which will trigger the code when the player hits it And the geiser is on. But the same system also has to work when the player hits other enemies. In the screenshot linked below you can see the part of the eventshet I'm talking about.

    What I want is:

    On collision with Particles


    is GeiserOn


    On collision with Enemy1

    Is there any way to make this happen? Not only is this useful here, but I can use that information in later projects too. I have ways of changing my sheet to make this possible (turning the collision box on and off) but I mostly want to know how I can do this in my initial way since it looks like something I'll encounter again very soon.

    Thanks in advance! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "On collision" is a trigger, which you can't use OR on. Just have the two separate events (AND works in the first case) and call a function that does the actions.

  • I fixed this by adding a GeiserCollision sprite without opasity, and I changed the scaling when the particles turn on or off. Here is a screenshot of how I fixed it:

    But i still want to know how I can do it the way I first came up with since I probably need it in the future.

    blackhornet, I don't really know how I should do that. Could you write a little example please?

  • On collision (sprite) with Particles creates a picklist containing That Sprite and That Particle.

    Any other following pick condition in the same event and in sub events will start to pick from that picklist (containing That Sprite and That Particle)

    Hence, that sprite that collides with Enemy1 is not present in that picklist (at this point the previous picklist).

    Whatever the outcome of the condtion (true or false) the actions have no object to run on.

    Conclusion: you have to start picking from scratch for the second condition.


    On collision with Particles

    is GeiserOn

    Actions: whats needed to be done

    New condition (picking from scratch)

    On collision with Enemy1

    Actions: whats needed to done

    This ofcours leads to re-using the same actions and to more code. Get a long with that using a function.



    On collision with Particles

    is GeiserOn

    Action: call function with parameters the UID of That one sprite and That particle

    New event (picking from scratch)

    On collision with Enemy1

    Action: call function with parameters the UID of That one sprite and That particle

    New event.

    On function

    Pick Sprite by UID ... do your thing

    Pick particle by UID ... do your thing.

  • You could make the code like my example below. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green"> ... .capx?dl=0


    1. There are 3 characters:

    a. Player (Sprite)

    b. Enemy (Sprite)

    c. Geyser (Particle)

    2. Player will lose a cookie only when it collides with Enemy or Geyser when the Geyser is turned on.

    3. Geyser gets automatically activated in every 5 seconds and lasts for 3 seconds.

    4. Enemy is equipped with a Line of Sight behavior, and chases Player when it approaches closely.

    If you want the enemy to trigger a cookie loss even when the geyser is turned off, then change Line 3's [System] -> [GeyserIsOn] to 0 and add another [System] -> [GeyserIsOn] to 1 below.

    Then you'll notice [System] -> [GeyserIsOn] is no longer needed.

    Then you can just add [System] -> [Subtract 1 from cookies] beside the initial [OR] statement.

    I arranged the code this way for you to learn an easier and better way of arranging conditions. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

  • On collision with Particles


    On collision with Enemy1


    is GeiserOn


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