Object IDs

Pix4r

Member
Hello,
Basically I want to make a system in my game where when I press spacebar a cone in front of player appears and if some object is in front of the player and the cone touches it, it will be collected into inventory (and dissapears from the room). If I simplify what I mean by object lest say like table, apple, bug, lamp, chair etc. many objects but I dont want to make(program) collision with every object separately. Is there some way to group them into like obj_item which would contain all of them but still know which one is which?
I don't need exact solution just if you know where I can learn how to do that I would be grateful!

Thanks everyone for reading/helping
 

Felbar

Member
use the parenting system, make an obj_item_parent , and make all the items children of that , then you just check for
obj_item_parent
 
I like how GMS deal with this questions. The have made an amazing job about it. For example, you are able to get instance_id easely. That is so "simple" for the developer. BUT when you are starting with this universe, things seems to be harder. :p
 

Pix4r

Member
use the parenting system, make an obj_item_parent , and make all the items children of that , then you just check for
obj_item_parent

thanks
I thought it would be something like class or inheritance. But now I still don't think I understand how to do it. Lets say I would like to show the item which is in contact with my cone on screen. I tried this: obj_item_parent + collision with cone - create instance, self, create obj_item_parent. But when I tried it all my items showed the item_parent on screen is there a way to create "itself" from obj_item_parent?
(if I collided with for example flower the obj_item_parent will show up instead of flower... just to clarify my messy description of my problem)
 

Nidoking

Member
object_index is the index for the type of object. Once you've found an obj_item_parent, you check its object_index to see which actual type of thing it is.
 
Top