SpareGold 4 Share Posted February 22, 2015 I understand how to manipulate inventory items and use them on each other, and I understand most of the interactions with GameObjects, but I cannot figure out how to use an inventory item on a fire. Can anyone explain this to me? Link to comment Share on other sites More sharing options...
Zawy 852 Share Posted February 22, 2015 This should work: GameObject fire = getGameObjects().getClosest("Fire");if(fire!=null){getInventory().getItem("").useOn(fire);} Link to comment Share on other sites More sharing options...
Vlad 216 Share Posted February 22, 2015 This should work: GameObject fire = getGameObjects().getClosest("Fire"); if(fire!=null) { getInventory().getItem("").useOn(fire); } You should also make sure the Item is != null and that Inventory contains the item. Link to comment Share on other sites More sharing options...
SpareGold 4 Author Share Posted February 22, 2015 Okay that's way too easy haha. I've been so used to making Lists and iterators that i forgot there were functions that apply to items like that. Thank you for the reminder! Link to comment Share on other sites More sharing options...
Zawy 852 Share Posted February 22, 2015 You should also make sure the Item is != null and that Inventory contains the item. True true, Had a few beers last night ;3 Link to comment Share on other sites More sharing options...
Recommended Posts