Spawning any of my 7 jewels at random

Hi

I'm relatively new to GS and am still learning...

I have 7 different characters (jewels) and would like to spawn any one of these
jewels at random to fall from the top of the screen... I have learnt how to spawn a
specific actor in random locations, but this is not what I want. I want any one of
my 7 jewels to appear at random so that there isn't an apparent sequence
(It's obviosuly a columns/Tetris style game

Hope I'm making sense

Thanks in advance!

Comments

  • mataruamatarua Auckland, New ZealandMember Posts: 854

    Hey there, on each row, to do this simply...

    You need to have have a loop that produces a number between 1 to 7.

    To prototype it use a timer that says every X seconds change attribute row1 to random(1,7)

    Use this number to control rules which spawn certain gems.

    Rule says in the actor, if row1 = 1 then spawn Green Gem, next rule if row1 = 2 then spawn Red Gem.

    That's the simple solution.

    Repeat for each row ~ row2 row3 etc.

    You will need integer attributes for each row you want to make different.

    I built a gem engine that even has rarity in it which is more complex using tables and mod loops but that's more advanced.

    Hope that helps :)

  • Nocturne31Nocturne31 Member Posts: 23

    @matarua said:
    Hey there, on each row, to do this simply...

    You need to have have a loop that produces a number between 1 to 7.

    To prototype it use a timer that says every X seconds change attribute row1 to random(1,7)

    Use this number to control rules which spawn certain gems.

    Rule says in the actor, if row1 = 1 then spawn Green Gem, next rule if row1 = 2 then spawn Red Gem.

    That's the simple solution.

    Repeat for each row ~ row2 row3 etc.

    You will need integer attributes for each row you want to make different.

    I built a gem engine that even has rarity in it which is more complex using tables and mod loops but that's more advanced.

    Hope that helps :)

    Thank you! I'm sure that's how you do it, now all I have to do is learn about tables :| can you note for me step by step how to do this using a table? Thank you and sorry for the inconvenience

  • mataruamatarua Auckland, New ZealandMember Posts: 854

    Sorry not got much time to do a complete run down or demo at the moment.

    But, the only reason I used tables was to get combos going with specific locations or patterns.

    You can get your prototype working, then come back and I can show you how to extract your data from tables if you like :)

  • Nocturne31Nocturne31 Member Posts: 23

    Sure dude! Thanks a lot for your time :) I'll be back...

Sign In or Register to comment.