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

2019/5/1

Change an images color.

1
2
3
Notted Notted

2019/5/7

#
Trying to implement HP into invaders.
if (getRotation() == 270)
        {
            Actor invader = getOneIntersectingObject(Invader.class);
            
            if (invader != null)
            {
                int invHP = world.getInvaders().getHP();
                world.removeObject(invader);
                world.removeObject(this);
            }
            else if (getY() == 0) world.removeObject(this);
        }
int invHP = world.getInvaders().getHP(); is a ref to int invaderHP = 0; in Invader. The problem is that getInvaders() is not found in the world class (Space) for some reason, even though it is in the class.
private Invader inv;
    public Invader getInvaders()
    {
        return inv;
    }
Notted Notted

2019/5/8

#
Nevermind! The problem was that world ref wasn't correct. It didn't point to the right world, which is Space.
You need to login to post a reply.
1
2
3