M
mickabrig7
Guest
Hello everyone,
I've been trying to reproduce the Undertale engine as an exercise for GML coding, but something is driving me crazy.
I've seen this in many games but I don't know what causes this : when pressing up / down or left / right at the same time, depending on the first pressed key, the character will either keep moving in the initial direction or start moving in the opposite direction.
For example, if you run Undertale, hold up and press down while holding up, you will keep on walking upwards. But if you do the opposite, you will change direction and walk upwards ! It's as if the up direction has some kind of priority, and the same thing happens with the left direction.
Since adding if statements for these special conditions would cause many problems and feel stupid, I'd like to know if anyone here could explain what causes this.
I'm pretty sure Toby didn't add a ton of conditions one after the other, I think this is caused by a function or a way of handling movements, but I couldn't find anything in any of the tutorials I've watched.
I've been trying to reproduce the Undertale engine as an exercise for GML coding, but something is driving me crazy.
I've seen this in many games but I don't know what causes this : when pressing up / down or left / right at the same time, depending on the first pressed key, the character will either keep moving in the initial direction or start moving in the opposite direction.
For example, if you run Undertale, hold up and press down while holding up, you will keep on walking upwards. But if you do the opposite, you will change direction and walk upwards ! It's as if the up direction has some kind of priority, and the same thing happens with the left direction.
Since adding if statements for these special conditions would cause many problems and feel stupid, I'd like to know if anyone here could explain what causes this.
I'm pretty sure Toby didn't add a ton of conditions one after the other, I think this is caused by a function or a way of handling movements, but I couldn't find anything in any of the tutorials I've watched.