spawning random buttons

OkyshoOkysho Member Posts: 158
edited May 2012 in Working with GS (Mac)
I'm trying to spawn a sequence of 20 buttons in a uniformed pattern, however each button has a numerical attribute between 1 and 25 (generated randomly) and then stores the attribute in a global variable.

Essentially, it's a 5X4 grid with random numbers.

My problem is that whenever I try and do a randomization between each spawn, I get a second (extra) button behind each of the original ones, overlapping. I isolated the problem to the randomization and I don't know why it happens (just a change attribute with the random function)

Anyone have an idea of how to implement this? or fix the problem? I don't mind re-writing code, I just want this to work

Answers

  • OkyshoOkysho Member Posts: 158
    Bumping 'dis thread
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Have you seen this video?

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

  • OkyshoOkysho Member Posts: 158
    edited May 2012
    Fantastic! Glad someone answered! Won't accept the answer until I'm 100% sure it works for my situation, but it's looking like it works so far
  • OkyshoOkysho Member Posts: 158
    Found a better solution on my own that better suits my situation. Thanks for bringing this video to my attention though. May become useful in the future
  • theCodeMonsterstheCodeMonsters Member Posts: 359
    I wish GS would add read/write to tables, or else I'd suggest using those. That's how I would do it if I was programing it, but it looks like you figured it out. So could you tell use how you did figure it out?
  • OkyshoOkysho Member Posts: 158
    Yes, that's how I would have done it as well.

    Here's what I decided to do.

    I have 25 weapons, each corresponding to a value (1-25) So I'm creating a single actor with 20 instances each generating a random number and changing the weapon based on the generated number. Each number stored into 1 of 20 attributes (since there are no read/write tables) to which I can use to write the AI for the CPU player
  • theCodeMonsterstheCodeMonsters Member Posts: 359
    @Okysho Ah, gotcha. Love the icon btw :) I'm not sure many people know who that is here. But I could be wrong.
  • OkyshoOkysho Member Posts: 158
    Nope. It's exactly who you think it is. It's sad that no one else knows such an iconic character. This is someone you should know, especially if you're making games...
  • theCodeMonsterstheCodeMonsters Member Posts: 359
    edited May 2012
    @Okysho I Agree 100%, that game changed the industry. Outa curiosity, do you know about Kingdom Hearts? AND do you think that it's cool or bad that they use cloud and other characters from Final Fantasy?
  • OkyshoOkysho Member Posts: 158
    I do know about Kingdom hearts, yes. I think it's a little odd that they use Final Fantasy characters in the games, however based on "alternate dimension" premise it's fairly tolerable. Since there's no focus an any Final Fantasy characters, I feel it's ok.

    Kingdom Hearts is built by the company who created Final Fantasy with licensing from Disney.
  • theCodeMonsterstheCodeMonsters Member Posts: 359
    @Okysho Nice, yeah I feel the same way. And I didn't even notice that it was built by the same people lol. No wonder it's so good.
Sign In or Register to comment.