hi all,
im doing a project where i have to implment a rpg game...
i have a class called item and the constructor looks something like
public Item(int x, int y, String image_path, boolean z)
{
map_x = x;
map_y = y;
image = new Image (image_path);
pickup = z;
}
I also have another class called player which has an array of type Item that stores what items the player has.
In the class Item, i made a method called pickupitem which stores the item into the player's inventory if the player comes to close.
the problem is, i not sure how to enter a item into the array
so i have something like:
if player comes within 50 pixels of item, then:
player.inventory[0] = ?!?!?
im not sure wat to put there...i tried doing something like this.clone() but it wouldn't work. I also tried doing new Item (this.map_x, this.map_y, this.image, this.pickup) but also didn't work. Can someone please help?
Thanks alot!