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

2018/1/11

Help with one.setLocation(one.getX()+x2,one.getY()+y2); and List<Statment> everyone = getWorld().getObjects(Statment.class);

Djolex Djolex

2018/1/11

#
I making game like supermario and my code have error on List statment and ove.setLocation
 @Override public void setLocation(int x, int y)
    {
        int x2 = getX()-x;//gets where the man is trying to move
        int y2 = getY()-y;
        //actorX = x; 
        //actorY = y;
        List<Covek> everyone = getWorld().getObjects(Covek.class);
        for(int g = 0;g < everyone.size();g++)
            {
                Actor one = everyone.get(g);
                one.setLocation(one.getX()+x2,one.getY()+y2);
            }
        ((Pozadina) getWorld()).setThing(x2, y2);
    }
danpost danpost

2018/1/11

#
If this deals with scrolling, maybe this will be answered by the scrolling tutorial linked to your other discussion thread. (better to let the actor move and have the world adjust everything depending of what limitation you place on the actors location)
You need to login to post a reply.