i have a Life class. which just prints a image of heart.
i want to have 6 lifes so iam adding 6 classes in arraylist. 1st heart one left. 2nd heart next to it.....
int life = 6;
//LIFE - create 6 heats and store in arraylist
lifeClass = new Life(0,0,10,10); //create heart
lifeStore.add(lifeClass); //store in array
lifeClass = new Life(20,0,10,10); //create heart
lifeStore.add(lifeClass); //store in arraylist
lifeClass = new Life(40,0,10,10); //create heart
lifeStore.add(lifeClass); //store in arraylist
lifeClass = new Life(60,0,10,10); //create heart
lifeStore.add(lifeClass); //store in array
lifeClass = new Life(80,0,10,10); //create heart
lifeStore.add(lifeClass); //store in array
lifeClass = new Life(100,0,10,10); //create heart
lifeStore.add(lifeClass); //store in array
les say i want to add a life.
lifeClass.setLife(lifeClass.getLife() + 1) //add one to variable
lifeClass = new Life(/*help*/); //create heart
lifeStore.add(lifeClass); //store in array[/code]
in this code above. i am adding one to variable. than create one more heart and add to arraylist.
the problem is that [code]lifeClass = new Life(/help/);[/code] i cant hard code the x,y,width,height postion. bc i dont which x postion to add to it. it x could be 0, 20, 40, 80, 100.