My attempt in this project was to make a game like mario. The mario games have always been some of my favorite games sense i was yonger and i would love to make a game like it. In my game you are able to run around on the platforms and shoot enemies.
Link to code: http://www.greenfoot.org/scenarios/14163
The game consists of a player, an enemy, platforms to walk on, and a barrel. My player at the begining of every game will spawn at the same spot everytime while the enemies and the moving barrel will spawn randomly thrghouth the world. The enemies move back and forth switching directions when it hits the edge or the platform ends.
Hard parts of my code:
The hardest part of my code was getting the character to reconize if there is a block above him and to bounce back down off of it instead of going through it.
This is the code that allowed this to happen:
public void bopHead(Actor ceiling)
int ceilingHeight = ceiling.getImage().getHeight();
int newY = ceiling.getY() + (ceilingHeight + getImage().getHeight())/2;