Get stuck on a complicated random system.

greedydadygreedydady Member Posts: 35
edited February 2014 in Working with GS (Mac)
Hey there everybody! So far i am working quite well on my project.
However, here comes the greatest challenge for me. I still not get a clue on it for few days.

This is called "Random enemies to a random spot" system.
The basic concept is:
1. Every a random time, a spawner randomly picking one of the enemies (a fix number every level) move to one of the 5 random locations.
2. The enemy wont move to a spot that contains an enemy inside.
3. Until the enemy in the spot has been destroyed, the spot will be available for random again.

I am trying to use the add/remove row function.
Whenever an enemy move to a location, remove the row it belong to. Until 5 rows removed(5 location get used). Copy the master table back to it. But it seems not working well.

If the enemies inside the spot never been destroyed (Which mean the 5 spots all contained an enemy). Later, the random enemies will move to the spot that already contained an enemy. I never want this happen.

My goal is: whenever there are at least one spot available, after a random time, random an enemy to one of these spot.

Is there any suggestion for me?
Is there a method that can add row one by one to a table?

Answers

  • kinzuakinzua Member Posts: 554
    I don't know if i can get you clearly. From what i get of it, you could have a different approach. Treat your scene like a table. When a row,col in your scene is occupied, change table value from 0 to 1. When its not occupied change it back to 0.

    Don't want to sound like a fool, but i hope this is what you've been looking for.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I built a demo but it's not thoroughly tested and I didn't spend that much time working through the logic. I just tried to get something generated that would start you off with an idea.

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

  • greedydadygreedydady Member Posts: 35
    Thanks you very much, this is really helpful and i get the basic idea of it. I will base on this sample and develop more. Thanks a lot!
Sign In or Register to comment.