Help! Actors appearing in the same place! Need tips on polishing this.

rommaromma Member Posts: 114
edited April 2012 in Working with GS (Mac)
Hi guys, Im fairly new here but I come from a design/program background so I think logically, anyways im really tied up in a knot on a specific issue regarding my first game.

I have several actors which appear randomly (based on random numbers) (they have there own "ID" atribute) in 8 different positions of my screen (iPad). There are 4 categories of actors. (but lets proceed with just 2 for this example) Each with 8 actors. Let's call them blue and yellow.

The game starts with spawning the "blue" actors, after a certain amount of those, we move onto the "yellow" (without stoping the spawn of blue).

My problem is at certain points I get blue and yellow actors poping up at the same time.

I've tried different approaches to having this solved but all methods seem to fail. Including a rule detecting collision. This latter doesn't work because of how I've set the game up in the first place.

Please help me, if I can pay whoever for 20 minutes of your time via skype that would be amazing!

Best Answer

  • tatiangtatiang Posts: 11,949
    edited May 2012 Accepted Answer
    It's a bandaid solution, but what about having a game.spawnTime (real) attribute and changing it to game.time each time an actor is spawned? And then in your spawner(s), have a rule that says When game.time does not equal game.spawnTime ... [spawn actor].

    The other thought I had was to create timer "windows" for your spawners. I'm not sure if this would work for what you need, but it's a way to alternate spawning without conflicts:

    http://dl.dropbox.com/u/19602014/timer windows.png

    (all four timers are set to "Run to completion")

    Basically, the blue actors "spawn" between 2.1-3.0 seconds (game.Time) while the yellow actors "spawn between 3.1-4.0 seconds (game.Time), and then the whole process starts over again two seconds later with blue spawning between 4.1-5.0 seconds and yellow spawning between 5.1-6.0 seconds.

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

Answers

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Add me on skype if youd like

    JohnPapiomitis
  • rommaromma Member Posts: 114
    Bump. :)
  • rommaromma Member Posts: 114
    Why would is be a bandaid solution?

    Since there are 8 different spawn locations, i've set a "if slot used" boolean and each animation has a rule that works "if slot used = false" - This is not working either.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Why would is be a bandaid solution?
    I just meant that it's not an elegant solution. It doesn't create a way to spawn in a random pattern without conflicts, but it does prevent two actors from spawning at the same time.

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

  • rommaromma Member Posts: 114
    I will give this a try, just need it to work. It's been a hole in my first game creation step.

    Thanks!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Also, if you don't want the actors to appear to spawn at the same time, you may need to adjust the condition so that the Spawn Actor behavior only occurs when game.time>game.SpawnTime+0.5, for example (wait 1/2 second after last spawned actor).

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

Sign In or Register to comment.