TheRudolfGaming
Member
Heya!
I'm currently making a game, which will involve effects.
When a player gains an effect, it will show up on the side like this. The game is going to be turn-based, so the effects' duration will also be decreased after each turn.
The problem is, I'm having difficulty figuring a better implementation of this.
How I'm currently doing it is a bit tedious and inefficient.
The effect timer is a sprite with
Each frame is enum'd, and set whenever the timer is updated.
As mentioned by the title, I already have an idea to make this more efficient, but don't know how to implement it.
Ideally, I would get the ratio from
If the ratio equals 1, it's a full circle.
If it equals 0.5, it's half a circle.
1/3 - a third of a circle
But I cannot figure out how I would have to write this in code.
I would appreciate any feedback! <3
I'm currently making a game, which will involve effects.
When a player gains an effect, it will show up on the side like this. The game is going to be turn-based, so the effects' duration will also be decreased after each turn.
The problem is, I'm having difficulty figuring a better implementation of this.
How I'm currently doing it is a bit tedious and inefficient.
The effect timer is a sprite with
image_speed = 0
Each frame is enum'd, and set whenever the timer is updated.
GML:
switch (effect_timer/effect_timer_max) {
case 1:
effect_timer_id.image_index = states.full;
break;
case 1/6:
effect_timer_id.image_index = states.onesixth;
break;
case 0.25:
effect_timer_id.image_index = states.onefourth;
break;
case 1/3:
effect_timer_id.image_index = states.onethird;
break;
case 0.5:
effect_timer_id.image_index = states.half;
break;
case 2/3:
effect_timer_id.image_index = states.twothirds;
break;
case 0.75:
effect_timer_id.image_index = states.threefourths;
break;
case 5/6:
effect_timer_id.image_index = states.fivesixths;
break;
}
As mentioned by the title, I already have an idea to make this more efficient, but don't know how to implement it.
Ideally, I would get the ratio from
effect_timer / effect_timer_max
, then plug that into a function, that would draw a partial sprite, from the partial circle.If the ratio equals 1, it's a full circle.
If it equals 0.5, it's half a circle.
1/3 - a third of a circle
But I cannot figure out how I would have to write this in code.
I would appreciate any feedback! <3