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

2013/6/26

Making hero bounce off the wall

davemib123 davemib123

2013/6/26

#
I am trying to make a bump effect when the hero makes impact with the tile if he drops from a platform but then quickly moves towards it, he will move onto it. I want to stop this, I have managed to get partially working for a section of the tile but not the whole tile. I've tried to attempt it using this:
public void act(){
       Actor Mario;
        Mario = getOneObjectAtOffset(21, 25, Mario.class);
        if(Mario != null)
        {
            Mario.setLocation(Mario.getX() + 10, Mario.getY() ); 
        }
    }
The second is how do I get it to check for the tile on the right side of the screen? My scenario is located here: http://www.greenfoot.org/scenarios/8881
You need to login to post a reply.