GarbageHaus
Member
I have a script that seems to do everything I want but when testing it displays everything all at once rather than one at a time. See the photo of the problem:
The goal is to have the text appear, slowly fade in and rise up at the same time. (Later I'll add a "fade out"). I left in a few of my comments so you can see my thought process. All methods attempted basically did the same thing.
Ignoring the fact that the colors and position are wrong, I can fix that later. The entirety of the loop is processed instantaneously regardless of how long my "length" is. The function is being called within a Draw Event via:
I've changed the loop types "do" "while" "repeat" but all behave the same way. I tried using an Alarm but the help guide's description of how that works is... lacking.
How am I supposed to delay this loop so that one frame = one frame?
The goal is to have the text appear, slowly fade in and rise up at the same time. (Later I'll add a "fade out"). I left in a few of my comments so you can see my thought process. All methods attempted basically did the same thing.
GML:
///Param text What you want to enter
///Param length how long text should last
///Param height how high the text should float up
///Param color of text.
function Risingtext(text, length, height, color){
alf = 0 //alpha value start.
rise = self.y + 0 //for rising
//prevtime = (delta_time / 1000000)
//if prevtime < (delta_time / 1000000) + 3
for (var i = 0; i < length; i++) {
alf = (i / length) //Alpha becomes more opaque as the percentage reaches 1.
draw_text_color(self.x,rise,text,color,color,c_aqua,c_blue,alf)
if (self.y - height) != self.y {
rise = rise - 1 //If the distance left to travel is NOT the current position then continue rising.
}
}
}
GML:
if keyboard_check_pressed(global.CON_ATTACK1) {
Risingtext("I'm just trash! Please don't punch!",22,13,c_red)
}
How am I supposed to delay this loop so that one frame = one frame?