S
sharooz
Guest
Hey Guys,
I am following "friendly cosmonauts" farming RPG tutorial and run into some strange issues(at least to me). So I am following the tutorial to about the same extend, however I seem to be missing something.
Heres my code:
In friendly cosmonauts video however, she doesnt really add y = y+moveY and x = x+moveX beneath the movement code but her character still moves for some reason. If i tried to do it without, my character wouldnt move at all. I am just here up in arms wondering how her character moves but mine doesnt despite of having the identical code.
Also the collision check, I ported the same exact code but her collision works on the x axis but mine doesnt. Is there someone who can help me out?
Thanks in advance.
I am following "friendly cosmonauts" farming RPG tutorial and run into some strange issues(at least to me). So I am following the tutorial to about the same extend, however I seem to be missing something.
Heres my code:
Code:
// Movement Variables
input_left = keyboard_check(vk_left);
input_right = keyboard_check(vk_right);
input_up = keyboard_check(vk_up);
input_down = keyboard_check(vk_down);
input_walk = keyboard_check(vk_control);
input_run = keyboard_check(vk_shift);
//Speed Variations
if (input_walk or input_run) {
spd = abs((input_walk*w_spd) - (input_run * r_spd)) ;
} else {
spd = n_spd
}
// Reset Move Variables
moveX = 0;
moveY = 0;
// Movement Code
moveY = (input_down - input_up) * spd ;
if (moveY == 0) { moveX = (input_right - input_left) * spd ; }
y = y + moveY;
x = x + moveX;
// Collision Checks
if (place_meeting(x+moveX, y, obj_collision)) {
moveX = 0;
}
Also the collision check, I ported the same exact code but her collision works on the x axis but mine doesnt. Is there someone who can help me out?
Thanks in advance.