Selecting one out of many actors? How to do it?
dieseljesus
Member Posts: 50
Hey, have a new problem i need help with. Its a game where i bring out tokens/markers on the screen. Its a bit like a boardgame. These markers are of a few different kinds. However, i spawn many of the same. For example. If i need to keep track of trolls and gnomes and stuff in a boardgame. Then i might spawn say 5 trolls, 9 goblins, 22 gnomes etc.
Now comes the problem. I have one button to destroy them all, and then i have a "kill zone" where i can drag this marker/token to get it killed. Is there any way to make these markers selectable instead? Right now all actor are draggable, but i would like to be able to highlight the marker when its selected too, and if its selected i should be able to touch a "kill actor" button.
I would also like to be able to increase/decrease hit point graphics on these actors if they are selected. One example.
I press the trollbutton 5 times and get 5 troll tokens... i press the gnome button 5 times and get 5 gnomes... then one of my gnomes gets killed in the IRL-boardgame. Then i just touch one of the gnome tokens, press delete and its gone.... Also one of my trolls are boosted... then i select one troll token, and press a + button to boost it and the result is that i change that image.
Do you understand what i mean? I would like to be able to in some way store what token is selected and then delete that one, boost it or whatever.... is this only possible with arrays?
PLEEEASE help!
//Matt
Now comes the problem. I have one button to destroy them all, and then i have a "kill zone" where i can drag this marker/token to get it killed. Is there any way to make these markers selectable instead? Right now all actor are draggable, but i would like to be able to highlight the marker when its selected too, and if its selected i should be able to touch a "kill actor" button.
I would also like to be able to increase/decrease hit point graphics on these actors if they are selected. One example.
I press the trollbutton 5 times and get 5 troll tokens... i press the gnome button 5 times and get 5 gnomes... then one of my gnomes gets killed in the IRL-boardgame. Then i just touch one of the gnome tokens, press delete and its gone.... Also one of my trolls are boosted... then i select one troll token, and press a + button to boost it and the result is that i change that image.
Do you understand what i mean? I would like to be able to in some way store what token is selected and then delete that one, boost it or whatever.... is this only possible with arrays?
PLEEEASE help!
//Matt
Comments
Why i want it selectable is because i dont want the "kill zone" where i drag the markers... i want just be able to highlight it by clicking ad then being able to press a delete button on the side of the screen.
Ok, here we go again:
1. I have 1 button that spawns an actor.
2. The actor have an image of a strawberry cake.
3. I press this button 55 times = i have 55 actors on stage
4. I touch one of these strawberry cake actors.
5. When i touch it, it is selected = Its highlighted to show that its selected.
6. Then i press a button where it says delete... that actor is deleted. The one that is selected that is.
Its basically like a desktop on a computer... if i select an icon, i can press the delete key to delete it.... I DONT have to drag it to the trash can. is THIS possible without arrays?
simply put... have 10 different spawn points where i can spawn unlimited actors... then select one of them and being able to deltete it.... Simple concept, but how to do it?
If cake=touched, change attribute self.selected to true
if self.selected = true, then destroy on input/keypress/touch/etc.
So you could set up your strawberry actor to have a boolean attribute "selected"
Then you could also have a boolean game attribute "killSelected"
For your strawberry actor, have a rule set up like
if pressed
-if selected is false
--selected is true
-otherwise
--selected is false
if selected = true and killSelected = true
-destroy
Then for your button, you could have something set up like
if pressed
-killSelected = true
-timer after 1 second
-- killSelected = false
Let me know if this helps!
-TK
----
if pressed
-if selected is false
--selected is true
--Change image to Selected Image
-otherwise
--selected is false
--Change image to Unselected image
----
I get this loop. Also. I need it to be unselected when i press the next actor.
1. I have 5 actors that are the same.
2. I press actor one. It is selected
3. I press actor four, than one is selected instead. See what i mean?
I tried to figure this out before by adding more flags, but i get dizzy thinking about it!
Hehe, i really hope this can get solved.... thanks btw for all help!
EDIT: brb with an example/template
What i think will be a problem is this:
1. I can select one brick/token/plate/actor or whatever.... but when i select another actor. It has to UNSELECT the last one used.
Will it be a problem?
1. When one actor is selected, i want it to be deletable by pressing delete.
2. WHen one actor is selected. I want to be able to press a + and - sign to change its image to images with higher or lower number.....
3. I want to be able to go back and forth between these actors to change them with the + and - but also delete....
One heck of a problem huh? It would seriously change the way i have done this app now but also give me more space for other things in it.
Right now i have 8 different spawn buttons.... i spawn actors with numbers on them.... 1,2,3,4, etc up to 8..... But if its solved i need one spawn point where i can spawn an actor with a 1 on it and then a + and a - button where i can change the numbers.
Uhh maybe search for it inside of GS? Idk, I've never downloaded a project off the web
Another thing... what mechanics should i use to be able to + or - the actor?
I have an idea, but its too much different variables in my head now to work this out.
Here is somewhat an idea of what i have now..... I have stripped it down and did some quick and dirty buttons etc there.. i dont want to give away too much of what im doing yet.....
sorry for slow loading, but everything is still in there, But off screen.
But the question now is....
How can i do so the + and - will change images to a 2/2, 3/3 etc on each token?
Like I said, be back later!
i want to show 2 different values on the token.... like power and toughness..... 1 / 2, 1/ 1, 3/5 etc.... i can change and control those values.
The problem now is that would like to have a "display text" attribute showing "Self.Power / Self.Toughness". Is that possible? Because if i put two different Display Text attributes there, they get on top of each other!?
you need to concatenate them with a \n (newline) to give you two lines
self.power.."\n"..self.toughness
Synth went into plenty of detail here http://www.gsproforum.com/viewtopic.php?f=21&t=111
You could add labels to your attributes as well if you wanted all with the single display text behavior
i can spawn token after token with say a 1/1 value.... if i change a few of them, i still can spawn 1/1 tokens.... but as soon as i delete the last selected one, i get left overs from the last selected one (The values are transfered from the deleted one to the new one!) and its not possible to change the new tokens values
Edit: Cant seem to solve this "left over" from the last token spawned... if someone would like to help me by taking a look at it, and maybe help me optimize this. I will of course include you into the credits etc. I would appreciate it alot.
Btw, thanks to all for helping me this far. I couldnt have done it without you!
I have some bugs tho and was wondering if someone would like to put 5-10 minutes to check my main behaviours for the tokens to see whats wrong with them. I dont think its anything dificult.
Here's what it looks like right now, visually i mean. Check it out and maybe someone like ToastKitten could help me out if you have time? You have done a bunch for me and i really really appreciate it, but could need some aditional help!
Check it out... this is a screenshot of the main gameboard!
http://www.minorempire.se/mtggrimoire/ss-game.png