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

2017/5/8

How to make an obstacle

陳映璇 陳映璇

2017/5/8

#
i am new to greenfoot, and there is a game i am working on. the game is alike to super mario, how can i make a obstacle?
danpost danpost

2017/5/8

#
Usually, the actor is moved, then if found intersecting an obstacle, it is moved back off it. Very basically, something like this:
1
2
move (speed);
if (isTouching(Obstacle.class)) move(-speed);
You need to login to post a reply.