• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Increasing a Draw Event?

H

Hudsonius

Guest
So under a draw event I'm saying:
Code:
<thescript>(view_xview[0]+33, view_yview[0]+16, text, width, 0);
This draws my script. However, the 0 after width I want to steadily increase. (this changes the script and yeah) However, I cannot find a way to set it to increase. I tried many different ways including an alarm slowly increases a variable and changing the code above from 0 to 0 + the variable, but that wouldn't work. If anyone has an idea or something it would be great.
 

Tthecreator

Your Creator!
Alright, what you need is some sort of counter.
You need to define how fast your counter should be.
Let's say you want you counter to go from 0 to 1 in 1 second.
If your game runs at 30 steps per second (or just frame per second (fps)) the counter needs to increase by 1/30th every step.
Now your game runs at 60fps so the counter needs to increment by 1/60th every step.
Continuing with this example, we now want the counter to go from 0 to 1 in 2 seconds and thus we need to increase if by 1/30th every step again. (we're still at 60fps)
Now instead of going from 0 to 1 we want to go to 100 so we need to increase our value by 1/3rd every step.
Does this make sense?
What you should get from this is the following formula:
Code:
valuePerSecond=value/time;//where the time is in seconds.
counter+=valuePerSecond*(1/game_speed);//where the game speed is your fps, game_speed is a build in game maker variable.
I hope this is useful to you.
 
H

Hudsonius

Guest
Alright, what you need is some sort of counter.
You need to define how fast your counter should be.
Let's say you want you counter to go from 0 to 1 in 1 second.
If your game runs at 30 steps per second (or just frame per second (fps)) the counter needs to increase by 1/30th every step.
Now your game runs at 60fps so the counter needs to increment by 1/60th every step.
Continuing with this example, we now want the counter to go from 0 to 1 in 2 seconds and thus we need to increase if by 1/30th every step again. (we're still at 60fps)
Now instead of going from 0 to 1 we want to go to 100 so we need to increase our value by 1/3rd every step.
Does this make sense?
What you should get from this is the following formula:
Code:
valuePerSecond=value/time;//where the time is in seconds.
counter+=valuePerSecond*(1/game_speed);//where the game speed is your fps, game_speed is a build in game maker variable.
I hope this is useful to you.
Thanks!!!
This seems to be working.
 
Top