This site requires JavaScript, please enable it in your browser!
Greenfoot back
spower21
spower21 wrote ...

2013/8/25

game programming help

spower21 spower21

2013/8/25

#
hey guys i need help with a couple things for my game. First, does anyone know how to make an item inventory in a game in greenfoot. Second, does anyone know how to make text appear on screen for a short amount of time when you get near something like "press "f" to read." Third, does anyone know how to make a health bar and make it so that enemies can deal damage to you. Thx guys!
danpost danpost

2013/8/26

#
An item inventory is probably best tracked in an abstract Inventory class (so each actor requiring one can have its own) and displayed by an Actor object (one instance should display one actor's inventory). A separate world could be used to display multiple Inventory actors and allow objects to be passed between them. As far as showing text when near something, use a double dual check for controlling it: (1) if text not showing and player is near, show text; and (2) if text is showing and player is not near, remove text. Finally, there are some healthbar support classes uploaded on the site. Mine is here.
danpost danpost

2013/8/26

#
(cont'd) Download it and copy/paste the code from the Bar class into a new class you create in your project. Usually any actor that uses one will have an instance field to hold its healthbar.
You need to login to post a reply.