• 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!

Legacy GM Variable Scaling Movement Speed

N

NthingSinistr

Guest
I'm new to Game Maker and have a question about a game bug that has been stumping me for an hour. I'm making a top-shooter with RPG stats that scale attributes. My code works for all but movement speed, where it scales way too quickly, making my character Quicksilver.

Here is my movement:

Code:
hspeed = global.walkingSpeed * (keyboard_check(ord("D")) - keyboard_check(ord("A")));
vspeed = global.walkingSpeed * (keyboard_check(ord("S")) - keyboard_check(ord("W")));
Here are my variables:

Code:
global.spd = 3
global.basespd = global.spd
global.walkingSpeed =  global.basespd + (global.spd / 1000)
global.spdGain = 1
Here is my level scaling system for movement:

Code:
   if (global.lvl = 1 && global.xp >= global.max_xp)
{
global.lvl += 1
global.spd = ((global.lvl - 1) * global.spdGain) + global.basespd
}
If you have a fix, I'd be more than happy to see it, as this is currently frustrating me. Thanks!
 
M

molcap

Guest
I'm new to Game Maker and have a question about a game bug that has been stumping me for an hour. I'm making a top-shooter with RPG stats that scale attributes. My code works for all but movement speed, where it scales way too quickly, making my character Quicksilver.

Here is my movement:

Code:
hspeed = global.walkingSpeed * (keyboard_check(ord("D")) - keyboard_check(ord("A")));
vspeed = global.walkingSpeed * (keyboard_check(ord("S")) - keyboard_check(ord("W")));
Here are my variables:

Code:
global.spd = 3
global.basespd = global.spd
global.walkingSpeed =  global.basespd + (global.spd / 1000)
global.spdGain = 1
Here is my level scaling system for movement:

Code:
   if (global.lvl = 1 && global.xp >= global.max_xp)
{
global.lvl += 1
global.spd = ((global.lvl - 1) * global.spdGain) + global.basespd
}
If you have a fix, I'd be more than happy to see it, as this is currently frustrating me. Thanks!
Sorry if I don't understand you at all (I speak spanish) but you want that the speed increases less when it level up? how much?
I would use a function like this (x = level)

Black (my system)
Red (your system)
 
Last edited by a moderator:
N

NthingSinistr

Guest
I want the speed to increase at a constant rate. I don't know what the constant should be until I test it out with a system that scales correctly, though.
 
M

molcap

Guest
I want the speed to increase at a constant rate. I don't know what the constant should be until I test it out with a system that scales correctly, though.
Then set global.spdGain a number between 0 and 1 and test (low numbers = low scale rate)
 
N

NthingSinistr

Guest
The spdGain I like is .125. Now how do I get it to be the same speed, but in whole numbers.
 
N

NthingSinistr

Guest
I meant something like displaying every instance of spdGain as +1 spd.
Example:
spd = 3
spdDisplay = 3

spd = 3.125
spdDisplay = 4

Can you show me how to do that, please?
 
N

NthingSinistr

Guest
Oh, I get what you're trying to tell me. I should have included one more example:

spd=3.25
spdDisplay=5

What do I use for that?
 
Top