How do I Work with multiple conditions per event

0 favourites
  • 10 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I'm trying to set up an event to trigger while a monster is not on screen The way I am trying to make it work is by having a condition to spawn the monster ONLY WHEN another monster is not on screen.

    And IF there is a monster on the screen the button will instead destroy it

    I Tried several methods for making this work.

    (Method 1)

    I grouped all of my monsters into a family and gave it a Boolean for spawned. default is false

    I then have two conditions set up for one set of events (Clicking add another condition)

    First condition is that there are no monsters spawned

    Second condition is when a button is clicked

    So In my mind the way this is laid out is (If there are no monsters on screen, and the button is clicked. Spawn a monster)

    This should trigger the event to spawn any one of my monsters but it doesn't the screen just stays blank

    If I remove the Boolean condition I can spawn an infinite number of monsters but that's not what i want

    (Method 2)

    Rather than use Boolean I tried the same as above with an instance variable swapping between 1 and 0

    No luck there either

    I think I'm setting these conditions up wrong but cant think of any other way to do it

    Here's a screenshot Just in case I'm not being clear

    http://i.imgur.com/Y9NlF8U.png

  • Those are instance variables. Since there are no monsters, they can't be checked. You can use Monsters.Count to see how many exist. So, in event one, check Monsters.Count=0.

  • Those are instance variables. Since there are no monsters, they can't be checked. You can use Monsters.Count to see how many exist. So, in event one, check Monsters.Count=0.

    How would I check for monsters.count? Do I chose instance variable still or do i I select something else entirely

  • "Compare two values"

  • "Compare two values"

    Thanks for the help and now how would I add something to that value?

  • I don't understand the question.

  • I don't understand the question.

    OH nevermind i think I made it more complicated in my head. The act of spawning a monster increases the count

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now second part of my problem I can get things to spawn once and thats great =D But now how do I set it so If something is spawned it will instead destroy that object.

    I just tried spawner clicked and monster.count = 1 then destroy but that doesnt seem to work that stops things from spawning again

  • Don't split up the events. Chances are you are spawning and deleting immediately. Make a sub-event for the count check.

    On click

    -> Monster.Count =0 -> spawn

    -> Else

    -> destroy

  • Don't split up the events. Chances are you are spawning and deleting immediately. Make a sub-event for the count check.

    On click

    -> Monster.Count =0 -> spawn

    -> Else

    -> destroy

    Thank you so much its working correctly now

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