I'm making a Yoshi's Island game, and I'm having trouble getting Yoshi to walk up and down slopes. I'm using a parent object for the slopes, and I'm using the following codes to handle the collision:
Yoshi step event:
Code:
var slope;
slope = instance_position(x,bbox_bottom+4, obj_slope_parent)
if (slope <> noone){
while not(place_meeting(x,y+1,slope))
y += 1
}
Yoshi collision event with slope parent object:
Code:
while place_meeting(x,y, obj_slope_parent)
y -= 1
This code doesn't seem to work though. Yoshi just sticks to the slope like this when he lands on it and doesn't go up or down it, like this (sorry for the bad screenshot, as it was really just to test it)
How can I fix this?
I'm making a Yoshi's Island game, and I'm having trouble getting Yoshi to walk up and down slopes. I'm using a parent object for the slopes, and I'm using the following codes to handle the collision:
Yoshi step event:
[code]var slope;
slope = instance_position(x,bbox_bottom+4, obj_slope_parent)
if (slope <> noone){
while not(place_meeting(x,y+1,slope))
y += 1
}[/code]Yoshi collision event with slope parent object:
[code]while place_meeting(x,y, obj_slope_parent)
y -= 1[/code]This code doesn't seem to work though. Yoshi just sticks to the slope like this when he lands on it and doesn't go up or down it, like this (sorry for the bad screenshot, as it was really just to test it)
[img]https://dl.dropboxusercontent.com/u/31438194/screenshot102%20%282%29.png[/img]
How can I fix this?