A
atxgamedesigner
Guest
Hello -
I decided to mess around with a little top-down prototype this evening.
For some reason I cant figure out why this movement script isn't working as expected.
Ha - it's past my bed time though, so I'm probably just not thinking critically enough on this...
But still - figured I'd post on here to see what you guys have to say.
Basically, I have 2 objects - an "upper body" and a "lower body" - (that way I could control the feet separately).
When using the W, A, S and D keys, the upper body moves and faces in the correct direction.
Unfortunately, the upper and lower body animations only work when pressing the D key.
So, just to recap -
W = moving up, but with idle upper and lower body animations.
A = moving left, but with idle upper and lower body animations.
S = moving down, but with idle upper and lower body animations.
D = works as expected...
Can't figure this one out.
I decided to mess around with a little top-down prototype this evening.
For some reason I cant figure out why this movement script isn't working as expected.
Ha - it's past my bed time though, so I'm probably just not thinking critically enough on this...
But still - figured I'd post on here to see what you guys have to say.
Code:
if (keyboard_check(ord('W'))) {
y -= 3;
image_angle = 90;
sprite_index = spr_Survivor_Walk;
obj_Feet.sprite_index = spr_Feet_Walk;
}
if (keyboard_check(ord('S'))) {
y += 3;
image_angle = 270;
sprite_index = spr_Survivor_Walk;
obj_Feet.sprite_index = spr_Feet_Walk;
}
if (keyboard_check(ord('A'))) {
x -= 3;
image_angle = 180;
sprite_index = spr_Survivor_Walk;
obj_Feet.sprite_index = spr_Feet_Walk;
}
if (keyboard_check(ord('D'))) {
x += 3;
image_angle = 0;
sprite_index = spr_Survivor_Walk;
obj_Feet.sprite_index = spr_Feet_Walk;
}
else {
sprite_index = spr_Survivor_Idle;
obj_Feet.sprite_index = spr_Feet_Idle;
}
When using the W, A, S and D keys, the upper body moves and faces in the correct direction.
Unfortunately, the upper and lower body animations only work when pressing the D key.
So, just to recap -
W = moving up, but with idle upper and lower body animations.
A = moving left, but with idle upper and lower body animations.
S = moving down, but with idle upper and lower body animations.
D = works as expected...
Can't figure this one out.