Further explanation: So let’s say I have a sprite with two animations, animation 1 and animation 2. I want it so that when I press an in-game button, lets say a right triangle, it changes to animation 2. And when I press a left triangle, it returns to animation 1.
I’ve been trying to figure this out yet I couldn’t. Sorry if its a stupid question
So whenever I press the triangle on the right I want it to highlight the circle next to it. As I keep on clicking, the number of circles that are highlighted increase.
But the way I coded it, a lot of the circles become highlighted. Here’s what the code looks like:
I don’t know your code but I know your code.
If your coed is like similar:
row 1: If botton is pressed
row 2: if animation = 1 then the animation = 2
row 3: if animation = 2 then the animation = 1
it is uncorrect.
try:
row 1: If botton is pressed then variable else = T
row 2: if animation = 1 then the animation = 2 and variable else = F
row 3: if animation = 2 and variable elese = T then the animation = 1
I think what you’re trying to achieve is to highlight only a specific amount of circles, depending on the volume, which can be regulated by the left and right arrow.
I would go about it this way:
store the volume value in a separate variable, for example called Variable_Volume.
By clicking the arrow buttons you can only increase the Variable_Volume button from 0 to 10, the amount of circles.
Now if the volume is 5 for example, you want only 5 circles high lighted.
So the logic in the events would look somewhat like this:
You loop through each instance, count on which instance you are on with a Variable (in my example it’s called object_counter), and if the instance is 5 or smaller, it will highlight. So the first 5 instances highlight.
For that obviously you need to make sure to create every instance in growing order. Otherwise the circles highlight in the wrong order when looping through them.
Also I’m not sure about your way of defining the animation number ±1.5. I thought animations are always round integer numbers?
In my example I used ‘Variable(object_counter)*2’ and ‘Variable(object_counter)*2 + 1’.
This way if you do the math, the first circle will be either animation 0 or 1, the second 2 or 3, and so on, so you can set the colors you want for each one.