help with spawning actors at empty random spawn points

jay2dxjay2dx Member Posts: 611
edited April 2014 in Working with GS (Mac)

Hi Guys,

ok so i followed thsirtbooths tutorial on: How to make Random spawn points with Tables

it works great but i was wondering how to also make actors spawn in the locations not used by the main spawning actor:

i.e. actor one spawns at location 1, leaving locations 2,3 and 4 empty,

what i want to do is spawn different actors in the other locations that arnt used, its random each time,

I tried this lol

"tableCellValue( game.Table 1 ,1, - game.spawn point )" here I've added the "-game.spawn point" which is the integer game attribute used, it never worked haha

any help would be great, thanks guys....

Comments

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

    Put each of the 4 possible positions in a table, one set of coordinates per row with x in column 1 and y in column 2.

    Each time you need to spawn actors, first change an integer attribute to random(1,4) and then use that attribute to spawn at the tableCellValue() for x and y in that row. Delete the row and pick an integer from random(1,3) and use that attribute to spawn at the tableCellValue() for x and y in that row. Continue until the table is empty.

    If you have more than 4 actors/rows or want to simplify your code, use random(1,tableRowCount(tableName)) instead of static integer values.

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

  • jay2dxjay2dx Member Posts: 611

    Thanks for the response tatiang, ill try and work it out with this info :) still learning here you see, and only just getting into tables.

  • jay2dxjay2dx Member Posts: 611

    Ahh i can't do it haha, really don't understand tables enough yet! grr.. can i post the project so you can please check it maybe, I'm sure your too busy though

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

    The best thing to do is watch videos related to tables so that you learn to use them properly. They are very powerful.

    http://forums.gamesalad.com/discussion/66768/forum-faq#cookbook
    http://forums.gamesalad.com/discussion/66768/forum-faq#searching

    You're welcome to post a link to download your file (.zip if first) and either I or someone else may have a chance to look at it.

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

  • jay2dxjay2dx Member Posts: 611
    edited April 2014

    @tatiang said:
    You're welcome to post a link to download your file (.zip if first) and either I or someone else may have a chance to look at it.

    Thanks man, I've tried doing this today after reading and watching some tutorials about tables but i can't get my head around the deleting rows etc, I've zipped up my file and hopefully someone can help me figure this out.

    Its just a simple tile tapping game, to teach myself some more basics of spawning and movement etc, I'm having trouble getting the tiles to stay synced with each other too as they all move downwards, its much better that i did it at first but still not consistent spacing and smooth like the tile games on the app store..

    so any help would be great guys, I'm sure others have made this game before too!

    thanks in advance jay..

Sign In or Register to comment.