spawning different objects at the same X-position without overlapping

mattias.l.anderssonmattias.l.andersson Member Posts: 4
edited July 2015 in Working with GS (Mac)

Hi!
I have small problem, spawning different objects at the same X-position without overlapping.

I want to spawn 3 different actors at specific X-positions but if one of the actors already is there i dont want a new one to spawn at the same X-position until the first one has left the position(0,5 seconds later maybe).

I was thinking of having a table with the X-positions i wanted to use, thats not a problem, It become a problem when the next actor spawns and it dont recognize the X-position as occupied.

Can anyone help me with this?

Edit: I tried to search to forum to find my answer but i couldnt find any solution to my problem. There were some threads about it but it seemed that the thread-maker found the solution by him self and didnt post how he solved the problem.

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    There is a video over at GSHelper on this very subject. Check it out.

  • mattias.l.anderssonmattias.l.andersson Member Posts: 4

    Do you mean this one?

    My problem is how to implement it with two different actors with different timers, i want both actors to use the same location table but i want it to be a endless loop, the row in the table should be free to use for a new actor as soon the first actor have left that X-position. I dont want it to be like in the video where a row is taken and then deleted.

    I'm creating a game where different objects are spawn at the top of scene at different time-intervalls(but its random so i could be at the same time and thats why i dont want them to overlap but 1 second later i should be able to use the same X-point) and then move down the screen.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2015

    Sounds like a bit of complex logic there. If you use the same random number generator for both and since the two have different time sequences you should he able to do a non repeating random number generator which would avoid the overlap possibility. That's the simpliest solution.

    If not then you would need to track each occupied spawn point and have some logic telling the next spawner to either delay it's spawn or pick another spawn point.

Sign In or Register to comment.