destroying and respawning multiple actors using an atribute
revoltandreverb
Member Posts: 159
Hi Guys. How can I destroy multiple actors with an attribute and then bring them back using that same attribute.
I'm currently spawning three random actors, and if a player clicks on one that matches the actor in the top right corner, I'm showing a message and then I want all the actors destroyed and respawned. Currently all actors disappear. I'm using 2 boolean attributes at the moment. Here is my mockup project file
https://www.dropbox.com/sh/cf7fev79mvcl7hi/AADGShMaMKVjm1EtNwxS8KTLa
Thanks!
Comments
This demo might help, instead of destroying the actor it simply picks a new number. If this isn't what you need/want let me know and I'll modify it.
Need Help? Email Me | Templates | Full Game Source Code
Thanks! I really appreciate your help. I'm still new to GS, so it took me a while to wrap my head around your demo, but it's quite genius. Only problem is, the letters at the bottom should be spawned at new random positions every time the correct letter is guessed. I'm going to use images for those letters not just display text. That's why I was spawning the letter actors so that I can destroy them and respawn them in new positions.
This is the post where I explain exactly what I want if you wanted to take a look, but I didn't receive replies, so I simplified my question as posted above.
http://forums.gamesalad.com/discussion/70296/destroying-and-respawning-actors-without-using-reset-scene#latest
I would name all of the letters 1-26.png (ex. A is 1.png)
For your actor constrain self.image to self.letter..".png" (This will change image according to that attribute)
Instead of respawning and destroying the actors I would change their positions or change their Attribute number so they become a new number. I would do this by storing 3 or 4 patterns in a table and picking a random pattern to align to.
If you need a template for this, let me know.
Need Help? Email Me | Templates | Full Game Source Code
A template for this just with just a,b,c would be much appreciated. It think I'm stuck in a specific way of thinking. Thanks!
I'm so close. Using your template I can change the letter positions randomly but I'm struggeling to align them to a grid in the table, specifically looks like they are overlapping. I used the "how to make actors not overlap using tables" tutorial with my orginal "scene" reset method so that row can be deleted after they have been used up, but it doesn't seem to work now. Pulling my hair our. The must always change position to a set grid that I have worked out.
https://www.dropbox.com/sh/5tsdrlansmw35jt/AABoSnKtKM7xOVfREPMDOXLIa
Thanks
I'll look at it. Do you want the actors to be randomly positioned or can they be aligned according to 1 (out of 5) set patterns in the table?
Need Help? Email Me | Templates | Full Game Source Code
@revoltandreverb I believe I fixed the problem. I added a timer so all all 3 actor's rules weren't running at the same time. It adds a little delay so the positions cant overlap and can only be chosen once.
Need Help? Email Me | Templates | Full Game Source Code
This is working perfectly, thanks so much! I couldn't believe such a simple concept could be so complicated. I really learned a lot from how you approached the entire thing as opposed to how I did it originally. One thing I noticed is that you placed all the actors on the scene as opposed to spawning them there, is there a specific reason? Thanks again.
Spawning takes up more ram than having them placed. I can also see how they are laid out and edit them to my liking.
Need Help? Email Me | Templates | Full Game Source Code
thanks