TeamSweepy / Greywater

Repo for Greywater Isometric RPG
2 stars 0 forks source link

Lootable Items #19

Closed Jeremy-Barnes closed 10 years ago

Jeremy-Barnes commented 10 years ago

So, items need to drop on the ground.

The way the world works, items need to be subclasses of entity. I've made some previous comments for Ziga here: https://github.com/TeamSweepy/Greywater/issues/7#issuecomment-36825145 https://github.com/TeamSweepy/Greywater/issues/7#issuecomment-36827926

The TLDR is that sprites can be drawn small using sprite.render(g,x,y,w,h), which lets you draw a tiny version of the sprite (which is what we'll use when its on the floor).

The hitbox should probably be used when the item is on the floor, and then there is a method for testing if a mouseclick intersects with the sprite (in Entity.java) that should be used when the item is in the inventory.

The level checks to see if you clicked an entity by calling "checkClickedInteraction" and passing the mouselocation. "CheckClickedInteraction" calls a method called "didPointHitImage" which is probably what you need to override in the Item subclass.

It will probably be easiest to keep track of the Item's state as boolean onTheGround and make didPointHitImage either check if the point hits the hitbox if it is on the ground and check if the point hits the sprite if its in the inventory.

You'll also need to override render so that if its on the ground it renders tiny based on its world coordinates, and if it is in the inventory it renders normally based on its slot coordinates.

These are just my thoughts based on how the world interaction system works, I am happy to discuss anything as needed.