Gamerev147
Member
I'm using the same movement system from my other top down shooters for my new engine. It's just a test movement system and will be changed in the future. But as of now I need to use it and it won't work in GMS2.
Could someone explain why this won't work?
Yes, I've tried the obvious... I get no errors...
My problem is that the player won't collide with the walls. Please help!
Could someone explain why this won't work?
Code:
hspeed = spd * (keyboard_check(global.KEY_RIGHT) - keyboard_check(global.KEY_LEFT));
vspeed = spd * (keyboard_check(global.KEY_DOWN) - keyboard_check(global.KEY_UP));
//Collision
if (collision_circle(x + lengthdir_x(6, direction) + hspeed, y + lengthdir_y(6, direction) - vspeed, 32, obj_Wall, 1, 1)) {
hspeed = 0;
}
if (collision_circle(x + lengthdir_x(6, direction) - hspeed, y + lengthdir_y(6, direction) + vspeed, 32, obj_Wall, 1, 1)) {
vspeed = 0;
}
My problem is that the player won't collide with the walls. Please help!