Creating objects

This forum is currently in read-only mode.
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I created a timing system for my game, every 1000MS it subtracts 1 from the global time varible, total time length of 3 minutes.

    At a specific time I want to create an object, I set it as:

    Is global varible 'timer' equal to 140 - Create object.

    Which works however it creates as many of those objects as it can for 1 second, and I'm unable to fix it. Does anyone know a fix?

    Alternativly can someone explain how I can give each enemy a % chance to create an object upon death(There health varible = 0)

    Any help would be great

  • I think I saw something like what you want the other day when looking through the starmap cap.

    Put the object creation inside an event group. Have a variable for the objects you want to create. Timer equals 140 = activate group.

    Upon creation:

    add +1 to that variable.

    Then: is variable great or equal to 1 = disable the creation group.

    (Not a very graphic example, but I hope you know what I mean. Otherwise try looking into the cap I mentioned).

  • Totaly never thought of that, makes perfect sense, well that fixes the set spawning, anyone know how I can lets say...

    5% Chance to add 1 to the varible thatll spawn the object when I destroy and object?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:39wryl1a]Is global varible 'timer' equal to 140 - Create object.

    Which works however it creates as many of those objects as it can for 1 second, and I'm unable to fix it. Does anyone know a fix?

    Add a "trigger once" condition to that event.

    [quote:39wryl1a]Alternativly can someone explain how I can give each enemy a % chance to create an object upon death(There health varible = 0)

    Add a subevent to the event that destroys the object and add the condition system -> compare.

    + System: Random(2) Equal to 0[/code:39wryl1a]
    That would be a 50% chance of being true.
    [code:39wryl1a]+ System: Random(10) Less than to 9[/code:39wryl1a]
    And this would have a 90% Chance.
  • Thats great, works perfectly. Thanks very much all.

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