Hi everyone,
I am currently busy making my own game as a school project. What I want to achieve is that I add every object that one of my Actors pick-up add up in an ArrayList.
My method:
A little translation here: 'munt' means 'coin' and 'waarde' means 'worth/value'.
Every coin that is worth 3 point needs to be added to an ArrayList. When I print the ArrayLists size I see that there is 1 entry, but when I pick-up another coin it stays at size 1.
This is my Munt.class constructor:
Does anyone have any idea how I can fix this problem?
Thanks in advance.
EDIT: If you think there is any missing information, just ask for it and I will post it.
public void bijhoudenOpgepakteObject()
{
ArrayList<Munt> muntBrons = new ArrayList();
ArrayList<Munt> muntZilver = new ArrayList();
ArrayList<Munt> muntGoud = new ArrayList();
if (waarde == 3)
{
muntGoud.add(this);
System.out.println(muntGoud.size());
}
} public Munt(String muntPlaatje, int tijd, int waarde)
{
setImage(new GreenfootImage(muntPlaatje));
this.tijd = tijd;
this.waarde = waarde;
}
