This is a more advanced version of stickman-basic, a platformer video game, consisting of a character on the screen, can move left, right and has the ability to jump. The character can also interact with the world, having a floor to stand on, obstacles to interact with (bounce, hit, ..) and maintain a score.
Code style: Google Java Style Guide https://google.github.io/styleguide/javaguide.html
Code style tooling: https://github.com/google/google-java-format
The configuration is by default loaded from "example.json" included in the source code.
If there is an error with the configuration an exception will be thrown on startup, so be sure to ensure that the configuration is well formed.
Some configurations are provided as well, to try them use use the command gradle run --args "[path to file]"
example.json
-- The example configuration, it includes a small level with a few enemiesbig_stickamn_fast_clouds.json
-- A configuration where the stickman is big and the clouds are fasterbroken_config.json
-- A JSON file that is not a well formed configuration, missing all the required information. This will cause an error on loadingbroken_config_2.json
-- Not even a JSON file. This will also cause an error on loading
The format for the configuration is reasonably straight forward. At the top level of the json we set some "global" configuration settings, things that are constant across all the levels. Some of these are the same from the previous assignment such as cloudVelocity and stickmanSize. There is a new object, Level, which contains all the level specific information:
- Stickman X position:
stickmanPos.x
- Level height:
height
- Level width:
width
- Floor height:
floorHeight
entities is a list of individual entities such as clouds, slimes, goals and platforms
name
: cloud, slime, goal or staticPlatformposition.x
: x position of the entityposition.y
: y position of the entity- (optional)
movement
: Only applies for the slimes, random, guard or stay
The different movements have different behaviors
guard
: the slime will walk back and forth over a spot, to guard itrandom
: the slime will move randomly, either left, right, jump or staying still. It may combine jumping with a directionstay
: stay will keep the slime in its starting position
- Enemies will cause damage to the player for standing near them
- Enemies can hurt each other, there is no loyalty among the slimes!
- Left arrow Move left
- Right arrow Move right
- Up arrow Jump
This app has been built in Java using Gradle conventions, so make sure you have JDK (Java Development Kit), version 8 or higher, and Gradle distribution installed on your machine (https://gradle.org/install/).
Next, go to the project's home directory and run ./gradlew run
in the terminal.