#Marixx weird button thingy

1 messages · Page 1 of 1 (latest)

granite lichen
#

@thorn cobalt
So just to be clear, you have 4 GREEN buttons.
When you click one of the buttons, you want one of the other 3 buttons to turn red, but not the one you clicked? Then when you press a different GREEN button, one of the other 2 buttons turn red?

thorn cobalt
#

When I click the green button, it turns red, and a other RED Button turns green

#

And so I can go on

granite lichen
#

Ohh alright

#

So there's always 1 green button and 3 red ones.

#

k now I understand

thorn cobalt
#

yeah

granite lichen
#

Let me think

#

Well the first thing you want to do is change the colour of the green button you pressed.
Once you've done that, take the 3 red buttons and change one of them to green.

#

You can check what button you've pressed using
string ButtonName = EvenSystem.current.currentSelectedGameObject.name

flint sapphire
#

dont you just want to have a script that has button array with legnth of 3 and green button variables on click randomly select from the array and assign the newly clicked button to the green button and the old back into the array

#

not said well but thats the logic

thorn cobalt
#

yeah

#

I guess

flint sapphire
#

which part do you need help with the scripting ?

thorn cobalt
#

All

#

lol

flint sapphire
#

bit hard when I can't see your setup but will try provide some code

granite lichen
# thorn cobalt All

Start with writing pseudocode to work out exactly what you need to do, like this

// Check if a green button has been clicked
// Get a random red button, change it to green
// Change the clicked button green.

Then work out each step

#

You don't even need an array

#

@thorn cobalt

thorn cobalt
granite lichen
#

Keep making a new list when you check the tags, because non-active gameobjects shouldnt be found when you check

thorn cobalt
#

So I got the logic to work now

thorn cobalt
#

But now I am stuck here

#

how can I make it so it cant choose the same Object twice?

flint sapphire
#

just add a last selected

thorn cobalt
flint sapphire
#

add another gameobject variable at the top saying lastselected

thorn cobalt
#

did

#

what now?

flint sapphire
#

then you need to do a validation in your switch if the last selected is the same

#

so an if statement

thorn cobalt
#

how do I do that?

flint sapphire
#

would suggest you do a few tutorials first on c# if you don't know if statements

thorn cobalt
#

I know if statements but I dont know how I can get the last case and compare it with the new one