how to get the height of another object

eams1986

Member
Hi! I have a problem :(

I would like to know how to obtain the height of an object

I have an o_ball

and the height of the object I want is o_tube

the ball goes through the tube and when it reaches the end of the tube, I want to destroy it

GML:
//step  o_ball   tengo este codigo
with o_tube {
    if y-sprite_height/2 {
        show_debug_message("up sprite");
        }
    else {
        show_debug_message("donw sprite");
        }
    }
Thanks
 

CloseRange

Member
objects don't have heights. Sprites do, and sometimes objects have sprites attached to them.

GML:
var height = sprite_get_height(spr_tube)
that will get you the height of the sprite you want.

GML:
var height = sprite_get_height(obj_tube.sprite_index);
that will get you the height from a sprite that's attached to an object.
 
Top