Help with creating a character customisation menu

I’m trying to make a character customisation menu where you can change your character’s skin colour, I want the player to be able to press an arrow to cycle through the options after every click and another arrow to cycle back after every click. How do I do this?

For each thing you want to adjust you will need to create number variable
For example you will create number variable called Hats

Now when you press arrow right you change Hats set to mod(Hats+1,3)

When you press left you change Hats set to mod(Hats-1,3)
(These events where you press left or right key you need to put trigger once in condition as last condition)

ONLY thing you need to care about here is that 3
It means you have 3 options there
0 1 2

As you see 0 is also accounted as number so it does not go as 1 2 3 but 0 1 2

So if you would have there mod(Hats-1,5)

Then it will be 0 1 2 3 4 ← five values starting from 0

You could now make object called Hat and each hat as new animation

Now you would change Hat animation by number set to Hats
Remember Hats is variable

And it would work on its own from now on

Only thing you would need to pay attention to is to put mod(Hats-1,HERE) as many animations as you have
basically last animation index + 1

So if your last animation index is 15 like i have
Then it means you have 16 animations so that is what you put in mod(Hats-1,HERE)

So mod(Hats-1,16)

Is this what you were talking about? I set my first sprite’s variable to 0 and my second one to 1 and then did this in the events tab:

This doesn’t work what did I do incorrectly?

Sorry for not understanding, I’m still learning how to use Gdevelop, thanks for your patience.

You are showing me only part of what i told you to do
And you expect me answer to why it does not work based on me knowing only partially what you did

That is quite a demand

Ok now what i see there assuming NewPanelSprite is arrow right
And NewPanelSprite2 is arrow left
You did everything correctly in this part
The 2 on end of your expression would indicate you have only TWO animations

So now where is screenshot showing how you are changing animation of your object?
Where is screenshot showing animations of your object?
That ALL need to be verified

So let’s see rest of it

I’m confused on the animation part, each of my sprites only have one animation and when I tried having two it didn’t work either.



The buttons don’t work and this is what happens:

My ballz object last animation index is 6 so as i told you it needs to be +1 in expression so it will be 7
So mod(FakeVar1+1 , 7 )
So mod(FakeVar1-1 , 7 )

Now to give some terminology here
My Ballz is yours object you want to change animation
My FakeVar1 is yours hats variable
My Gun2 is yours NewPanelSprite
My Gun is yours NewPanelSprite2

So when you click Gun2 (Shotgun object) you add 1 to variable
When you click Gun (Pistol object) you subtract 1 from variable

And lastly event that sets animation by number of Ballz to FakeVar1

And now click either pistol or shotgun and animation of ballz will change
Where all animations of my ballz is same image just with different color

Sorry for all of the trouble but it’s all sorted now, but I don’t understand what the “change number of the animation of AlienBeigeSquare set: to hats” actually means or does, if you can explain what it does it would be much appreciated. Thank you for your time.

I did reply to you but we have here strict filter and sometimes it catches messages that it should not

I screenshot 1st part of it which is what you need to do
Where rest is just explanation why you need to do it
Which is wall of text so i guess you don’t lose much

Here is part that did not fit screenshot

So whatever FakeVar1 value is
I order my game to set animation of ballz to that value
In your case it would be change number animation of AlienBeigeSquare set to hats
Where you manipulate hats variable in separate event

So enjoy screenshot while waiting for mod to approve on my message

1 Like

Thank you so much for your help, means a lot!

Don’t be sorry
We all needed to gain knowledge somewhere

And i think i don’t understand your question
So if this is not what you are asking for ask in more detail

1st of all look at this image

You see in 1st and 2nd event i am manipulating FakeVar1 variable
Either i add or subtract it
Does not matter all you need to understand i am changing it
Now in 3rd event i am changing number animation of ballz set to FakeVar1
So whatever FakeVar1 value is
I order my game to set animation of ballz to that value
In your case it would be change number animation of AlienBeigeSquare set to hats
Where you manipulate hats variable in separate event

Now so you understand what is going on prepare yourself for wall of text

In world of programming we have VALUES

Your nickname GCC and my nickname ZeroX4 are TEXT values
For this forum in each user case its just some text value which we set as we want
Now imagine by default this values are set to NewUser so each new user would have nickname NewUser until such user would change it to whatever he want

Now imagine if you would set your nickname to AvatarFileName (such thing does not exist but just imagine you could do that)
Which would mean whatever file name of your avatar file is for example in my case ZIcon.png as soon as i upload my image and set it as my avatar to it
My nickname would change to ZIcon.png

Because everything reads SOME values from some places
In this case it would be value from file
In case on how we actually set our nicknames it is reading value from Nickname field of page in which you create your account

Now that you understand logic behind taking value from one place and using it in other

Imagine changing animation of your object works on same exact principal

You can manually set animation of your object to 1 or to 2
BUT what if instead 1 or 2 you type there name of some variable
And now you set that variable to either 1 or to 2?

Well animation would change accordingly
So in other words you use variable as some sort of control value

Same exact way as you have text object
You can set it to idk let’s say apple
But you could place objects on your scene like Orange Apple Banana and so go on
Put them all in object group called Fruits
And now you could change text of text object to Fruits
Where in condition you would set like
Cursor is on Fruits
So on whatever object from Fruits object group cursor would be
Name of that object would appear in text object
Cause instead of static value (text) you set value that VARy so you made VARiable

Where actual variables are separate things
You could technically for sake of what you are doing change animation of your object to mod(ObjectName.Animatio::Index()+1,2)

But i bet later on you will want to create save/load system
And you can save/load only variables so that is why i told you to go with variable

Just for sake of clarity
Another example
Imagine you want player to have HP
You could put in text object HP : 100
BUT what if player gets hit? How do you change that?
HP : 100 is text its not a number so what you do?
well you need variable for that
For example give your player variable and call it HP
And now you change text object text to "HP : "+Player.HP

And now you will still get HP : 100
But if you subtract 10 from Player.HP variable
Text will display HP : 90

Cause text object now reads VALUE of variable and dynamically display it as you are updating (changing) it elsewhere