Is this the best way to do it? Or is there an easier way, i just want a smooth movement on my character without being stuck all the time and all the other crazy stuff.
Btw, 'status' is just for my sprites.
if !place_meeting(x,y+1,obj_solid){
y+=!place_meeting(x,y+1,obj_solid)
}
//LEFT
if (keyboard_check(vk_left) || keyboard_check(ord("A"))) && !place_meeting(x-1,y,obj_solid) {
x-=!place_meeting(x-1,y,obj_solid)
image_xscale=-1
if place_meeting(x-1,y,obj_solid) {
hspeed = 0
}
if place_meeting(x,y+1,obj_solid) {
status=1
}
if !place_meeting(x,y+32,obj_solid){
status = 2
}
}
//RIGHT
if (keyboard_check(vk_right) || keyboard_check(ord("D"))) && !place_meeting(x+1,y,obj_solid) {
x+=!place_meeting(x+1,y,obj_solid)
image_xscale=1
if place_meeting(x+1,y,obj_solid){
hspeed = 0
}
if place_meeting(x,y+1,obj_solid){
status=1
}
if !place_meeting(x,y+32,obj_solid){
status = 2
}
}
//RELEASE LEFT - RIGHT
if (keyboard_check_released(vk_left) || keyboard_check_released(vk_right)) or (keyboard_check_released(ord("A")) || keyboard_check_released(ord("D"))) /*&& status!=3*/ {
hspeed=0
if place_meeting(x,y+1,obj_solid) {
status=0
}
}
Edited by ohaithar, 17 April 2012 - 04:08 PM.











