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

2016/2/18

Count Points

STRANGERPEOPLE STRANGERPEOPLE

2016/2/18

#
Como posso fazer para contar pontos quando um ator getOneIntersectingObject ?
Super_Hippo Super_Hippo

2016/2/18

#
The question is: How do you want to save the points? If it is just in a variable, then this is enough:
private int points = 0;

public void act()
{
    //moving etc.
    if (getOneIntersectionObject(NameOfTheClass.class) != null)
    {
        points++;
    }
}
Instead of line 6, you can also use this:
if (isTouching(NameOfTheClass.class))
You need to login to post a reply.