GameSalad

Spawn a variety of random actors without overlapping

I have the Actors.

Death 1
Death 2
Death 3
Death 4

I have created another actor called 'spawn death drop'

I have made an attribute called 'which actor'.

Within 'spawn death drop' i have randomized the actors to appear using the 'which actor' attribute.

However, there are some instances when the actors will be overlapped.

Is it possible to make them appear randomly but not overlap.

Thanks,

Comments

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef

    That's a lot of death.

    How are you spawning your actors? Are you using a timer? Are they spawning at a certain scene position? Are they moving at a certain speed and direction?

    More details are needed...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • aidanshaw92aidanshaw92 Posts: 17Member

    Correct. There is a lot of death.

    I am spawning my actors from an actor called 'spawn death actor'

    i have an attribute called 'which actor'

    Within 'spawn death actor' i have the following;-

    Timer
    -Rule
    --Timer, every 0.5 seconds
    ---change attribute game.which actor to random(1,4)

    Death actor 1
    -if game.which actor = 1
    --spawn actor=1 from position random(10,365) , random(0,5)

    Death actor 2
    -if game.which actor = 2
    --spawn actor=2 from position random(10,365) , random(0,5)

    Death actor 3
    -if game.which actor = 3
    --spawn actor=3 from position random(10,365) , random(0,5)

    Death actor 4
    -if game.which actor = 4
    --spawn actor=4 from position random(10,365) , random(0,5)

    They all move at the same speed upwards.

    The aim of the game is to fall down and miss the 'death actors' and hit a 'target actor' on the way.

    However when i arrange the target actors in the same way as above there are instances when the 'target actors' and 'death actors' overlap.

    Hope that makes sense> @tatiang said:

    That's a lot of death.

    How are you spawning your actors? Are you using a timer? Are they spawning at a certain scene position? Are they moving at a certain speed and direction?

    More details are needed...

  • IceboxIcebox Posts: 1,434Member, PRO

    You can do it by table to determine spawn location of actors so they dont overlap but you will need to put in the locations. Watch this tutorial

    or you can spawn a grid (or place small actors on screen to form a grid) and do the same random method your using to spawn the death actors ,then set the alpha of the grid to 0 .. it might not be the best way to do it though :) here is an example

  • aidanshaw92aidanshaw92 Posts: 17Member

    In the video he doesn't talk about how he got the information to put in the table.

    That's what im struggling with. How do you work out the spawn points?

  • aidanshaw92aidanshaw92 Posts: 17Member

    In the video he doesn't talk about how he got the information to put in the table.

    That's what im struggling with. How do you work out the spawn points?

    @Icebox said:
    You can do it by table to determine spawn location of actors so they dont overlap but you will need to put in the locations. Watch this tutorial

    or you can spawn a grid (or place small actors on screen to form a grid) and do the same random method your using to spawn the death actors ,then set the alpha of the grid to 0 .. it might not be the best way to do it though :) here is an example

Sign In or Register to comment.