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

2013/4/2

Life problems...

1
2
JetLennit JetLennit

2013/4/2

#
your's because i understood it the best for if i need to modify it further
danpost danpost

2013/4/2

#
Please post what you ended up with (since you modified it).
JetLennit JetLennit

2013/4/2

#
  ArrayList<Alien> currentContacts = new ArrayList<Alien>();
    currentContacts = (ArrayList<Alien>)getIntersectingObjects(Alien.class);
    {
    for (Alien alien : currentContacts)
    {
        if (!aliensContacted.contains(alien))
        {
            aliensContacted.add(alien);
            lives--;
            if (lives == 0)
            {
                String text = "Your score was: " + totalCount;
                JOptionPane.showMessageDialog(null, text);
                reset();
                Greenfoot.stop();
                return;
            }
    }
    }
    }
JetLennit JetLennit

2013/4/2

#
If you have any ideas for how to make space survivor please say them now.... (except for adding aliens... trying to come up with graphics for them)
danpost danpost

2013/4/2

#
I think you will still have to remove aliens from the contactedAliens list when they no longer show up in the currentContacts list. If you do not, then when you contact that alien at a future time, it will not do any 'damage'.
You need to login to post a reply.
1
2