S
Simulacron
Guest
I want to check if my oPlayer instance can see another instance (oInputable), without beeing blocked by all other instances, grouped under the object oNotInputable. Both of these objects are children of the oSolid object that makes them all solid for the Player.
To check this collision I use the following code:
collision_line_first is a script that returns the first object that the collision line hits.
After I got the instance id with this script I want to check if I got my oInputable instance or an instance from the oNotInputable group. I tried to check if the instance is equal to the oInputable, but I think that this isn't possible. Is there any other way to check which object type the instance is?
To check this collision I use the following code:
Code:
target = noone; //Resets target
target = collision_line_first(oPlayer.x+global.size/2,oPlayer.y+global.size/2,mouse_x,mouse_y,oSolid,false,false); //finds first solide object thats between the mouse and the player (global.size is just a variable to make it easier to change the scale of the game and centers the collision line in the middle of the player)
if target != oInputable{ //Check if instance id is equal object --> doesn't work
target = noone; //reset target if instances isn't an oInputable
}
After I got the instance id with this script I want to check if I got my oInputable instance or an instance from the oNotInputable group. I tried to check if the instance is equal to the oInputable, but I think that this isn't possible. Is there any other way to check which object type the instance is?