How do I Spawn a single Instance of an Object

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi All

    I'm still working on my Mosquito Game and have the following Problem:

    When i turn the Light off, i want it to spawn one Mosquito in a certain Timeframe. Now, it seems to work but if i turn on and off the lights quickly a few times and then leave it off, it spawns multiple Objects for some reason that i'm too stupid to yet comprehend...

    It would be fantastic, if somebody could take a look at it: https://drive.google.com/file/d/0Bwu0b_ ... sp=sharing

    Thanks so much!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Move the "Set MosqOn to 1" action above the "Wait". What is happening is, you are starting multiple spawn events before setting the MosqOn variable. The Wait command does not wait to allow the system to continue processing, just the actions in the current event that are below it in the list. Since you are waiting the given amount of time to set the variable, the game loops through and finds all the variables still match the event trigger. With the "Trigger Once" condition, it will only trigger once while all the conditions remain true but once you turn the light on and off, the condition is reset.

    I hope that answers your question and good luck with your project.

  • Thanks a ton !

    Now it works like a charm It's funny, i seem to have the right ideas but whenever there's a bug i often times just have the orders wrong... I hope i'll get my head around that someday...

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