How should I do, that out of 8 objects to a random one of them spawn 1 enemy?

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • It would be useful for me to do it in a similar way:

    System On start of layout-->Sprite spawn to random object (object is a famyli)

    Thank you!

  • There is a system 'pick a random instance', then choose the object as family.

  • System pick a random famyli instance-->Famyli spawn sprite

    It happened that there was a lot of spawn everywhere sprites.

    Why?

  • On its own it will do it constantly. You need to have it as a sub event under 'on start of layout', so press S on the 'on start of layout' event and add the logic there as a sub event so it triggers once on start of layout.

  • Thank you very much!

  • Hi

    I have a similar question.

    How do I make 1 always more characters spawn in the game?

    system on start of layout-->Add action

    System trigger once

    System pick a random famyli instance-->Famyli spawn sprite

    sprite on destroyed-->Add action

    System trigger once-->Add action

    System pick a which there is no other object famyli instance-->Famyli spawn + 2 sprite

    My questions is:1.- How to do it system pick a which there is no other object famyli instance

    2.-Famyli spawn + 2 sprite

    Thnak you!

  • If I'm understanding it correctly, do you mean pick a family instance that has not been picked yet?

    When you pick a random family instance to begin with, and spawn a sprite, you can set a family instance variable from 0 to 1 for example.

    Then your logic becomes pick a a random family instance + condition : family instance var = 0 (not picked yet).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh thank you!

    And how To Do It If the object is destroyed then always obhect more spawn?

  • Hmm a few ways but depends how your game works, it gets a little tricky.

    When you spawn the sprite on the family, you can relate them to each other by for example setting an instance variable on the sprite to the family object UID, or you could have a family instance variable on the family object, and when you create the sprite, set a variable on the sprite to the same value, so family.var is 5 and sprite.var is 5 for example and they are related.

    Then when the sprite is destroyed, you find the family object that has the same var value, and you set the family object picked variable (from the other comment 0 to 1) back to 0 (unpicked).

    Another way is for example if the sprite always overlaps the family object, you could say on destroyed pick family object that is overlapping sprite and set the variable back to 0 (unpicked). This only works if that is true though about the overlapping.

    In general, you just make the sprite created relate to the family object in some way, usually with variables.

  • Thank you!

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