Collision against any pixel of object, ignoring bbox

A

AirforceMook

Guest
I have an odd situation in which I need to check if a pixel is in ANY way covered by other objects even if their bounding box is far away.

An example I'm currently facing is a tree that is 100+ pixels tall but the bounding box is a small square only at where the trunk meets the ground (so players can walk behind the tree). I still need to know if the top of the tree is covering a certain pixel because I don't want to spawn an object where it can't be seen.
 
Based on your wording, you could simply denote where this spot is on the sprite in the editor, then check this offset from the actual drawing position in the game (using lengthdir, for example). If you have a bunch of tree sprites, you could use approximation and just create a boundary around the tree top where you don't want the instances to be able to spawn at.
 
A

AirforceMook

Guest
I appreciate the reply, but not what I mean. I'm not looking for a specific pixel of a specific sprite to be empty, but rather a specific location / pixel within the game room.

What I'm testing right now is drawing all objects in the room to a surface and then using surface_getpixel to check if anything was drawn to that spot.
 
Top