J
jr carey
Guest
How would I go about implementing this?
so, I understand I have to get the left red value distance, and the right value distance, divide it, and put that value in the image angle, but I cant see to figure out how to go about doing that, I don't want it to only be a 45 degree slope though, it needs to be dynamic.
ive tried:
var obj = instance_nearest(x,y,obj_ground)
var d1 = point_distance(x-(sprite_width/2),y+(sprite_height/2),
obj.x,obj.y)
var d2 = point_distance(x+(sprite_width/2),y+(sprite_height/2),
obj.x,obj.y)
image_angle = (d1/d2)*100
but it flips out, gets stuck in walls, all I want it do is rotate to the floors angle, even if its a round
so, I understand I have to get the left red value distance, and the right value distance, divide it, and put that value in the image angle, but I cant see to figure out how to go about doing that, I don't want it to only be a 45 degree slope though, it needs to be dynamic.
ive tried:
var obj = instance_nearest(x,y,obj_ground)
var d1 = point_distance(x-(sprite_width/2),y+(sprite_height/2),
obj.x,obj.y)
var d2 = point_distance(x+(sprite_width/2),y+(sprite_height/2),
obj.x,obj.y)
image_angle = (d1/d2)*100
but it flips out, gets stuck in walls, all I want it do is rotate to the floors angle, even if its a round