T
TonyZh
Guest
I have problems with getting my Camera Control working. I think my movement control code interferes with my Camera Control.
My movement uses W, S, D and A to move around and shift to walk faster.
My Camera can move if the player presses the C button and uses the W, S, D and A button to move the Camera around. The Camera works fine if I don't move it around.
and
Thank you for helping me out!
My movement uses W, S, D and A to move around and shift to walk faster.
Code:
if(keyboard_check(ord("D")) && place_free(x + collisionSpeed, y)) {
x +=walkSpeed;
image_speed = walkSpeed/3 ;
sprite_index= sprSaraWalkRight;
}
if(keyboard_check(ord("A")) && place_free(x - collisionSpeed, y)) {
x -=walkSpeed;
image_speed = walkSpeed/3 ;
sprite_index= sprSaraWalkLeft;
}
if(keyboard_check(ord("S")) && place_free(x, y + collisionSpeed)) {
y +=walkSpeed;
image_speed = walkSpeed/3 ;
sprite_index= sprSaraWalkDown;
}
if(keyboard_check(ord("W")) && place_free(x, y - collisionSpeed)) {
y -=walkSpeed;
image_speed = walkSpeed/3 ;
sprite_index= sprSaraWalkUp;
}
if(keyboard_check(vk_nokey)) {
image_speed= 0;
image_index= 0;
walkSpeed= 3.5;
}
if(keyboard_check(vk_shift)) {
walkSpeed= 5;
}
Code:
moveCam = keyboard_check(ord("C"));
if(moveCam){
x += (keyboard_check(ord("D")) - keyboard_check(ord("A")))*6;
y += (keyboard_check(ord("S")) - keyboard_check(ord("W")))*6;
} else {
x = clamp(x, following.x-h_border, following.x+h_border);
y = clamp(y, following.y-v_border, following.y+v_border);
}
Code:
following = objSara;
h_border = 60;
v_border = 30;
Last edited by a moderator: