need help with a "look around" feature

Atom_5
23 Aug 2016, 04:08

I want to program my game so that in any room or area when I say look around, and item or all items will become visible. For i.e.: look around: you find a lightswitch or a desk, a chair, a book can now be seen in the room. does anyone know of a tutorial or could help me with this?


The Pixie
23 Aug 2016, 07:02

At its simplest, what you want to do is code the command so it works through each item in the room and sets it to be visible. The players current location is player.parent, and the function to get all the objects in alocation is GetAllChildObjects. Use foreach to iterate through them, like this:

foreach(obj, GetAllChildObjects(player.parent)) {
  obj.visible = true
}

Atom_5
23 Aug 2016, 23:07

Awesome thanks for the help. I will give it a try, still new to this.