SpareGold 4 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?
Zawy 1036 Posted February 22, 2015 This should work: GameObject fire = getGameObjects().getClosest("Fire");if(fire!=null){getInventory().getItem("").useOn(fire);}
Vlad 216 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.
SpareGold 4 Author 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!
Zawy 1036 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.