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

2 days ago

How can i push an object?

svenfrijters svenfrijters

2 days ago

#
I am making a game but i want actor1 to push the actor2 in de same direction actor1 went. But i dont know where to start because this is my first time doing something like this. Can somebody help me out? I do know how to make actor1 move. But not how to push actor2
danpost danpost

2 days ago

#
svenfrijters wrote...
I am making a game but i want actor1 to push the actor2 in de same direction actor1 went. But i dont know where to start because this is my first time doing something like this. Can somebody help me out? I do know how to make actor1 move. But not how to push actor2
Show your code moving actor 1 and detecting actor 2.
svenfrijters svenfrijters

yesterday

#
 private void checkDribble()
    {
    olifant a = (olifant) getOneIntersectingObject(zaag.class);
    if(a != null)
    {
        move();
    }
i know im far off but i dont know where to continue. I cannot find anything on the internet. Btw Olifant is actor1 and zaag is actor2
danpost danpost

yesterday

#
In what class is the code given placed into? Line 3 looks like it takes an object of one type and places it in a field that holds a different type.
You need to login to post a reply.