Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Task Description
In this assignment, you will create a game in the Java programming language using the Processing library for graphics and gradle as a dependency manager. In the game, the player must avoid enemies that are moving around the map, and reach the exit to progress on to the next level.
You have been given the task of developing a prototype of the game. A full description of gameplay mechanics and entities can be found below. An artist has created a simple demonstration of the game and has posted it on your online forum (Ed).
You are encouraged to ask questions on Ed under the assignments category if you are unsure of the specification – but staff members will not be able to do any coding or debugging in this assignment for you. As with any assignment, make sure that your work is your own, and do not share your code or solutions with other students.
You have been given a scaffold which will help you get started with this assignment. You can download the scaffold onto your own computer and invoke gradle build to compile and resolve dependencies. You will be using the Processing library within your project to allow you to create a window and draw graphics. You can access the documentation from here.
The game contains a number of entities that will need to be implemented within your application.
The map consists of a grid of tiles 33×36. Each tile is 20×20 pixels, so the total is 720×660 pixels. The player always begins in the top-left corner of this grid. However, the bottom 60 pixels of the window are reserved for the information bar which contains text to display the current number of lives, spell cast cooldown bar, current level number, and timer remaining on the powerup’s effect. The window size is therefore 720×720.
There are 3 main types of tiles:
The map is always surrounded by a stone wall. The map layout is specified in a file named in the “layout” attribute of the level in the JSON configuration file described below.
The config file is in located in config.json in the root directory of the project. Use the simple json library to read it. Sample config and level files are provided in the scaffold.
The config sample as shown to the left, contains the names of the level files. These are also located in the root directory of the project. The level files will contain a grid of text characters, where each character represents what should be in that tile cell.
Note that a map is valid if it has a bounding border of cement tiles, contains a starting point and exit, and is of the correct dimensions. (all maps used for marking will be valid, but you should write your own tests for invalid maps and handle them as you see fit).
The “wizard_cooldown” property of the level denotes in seconds the cooldown time between spell casts.
The “enemy_cooldown” property denotes in seconds the cooldown time between gremlins shooting slime.
The player character is controlled using the arrow keys (up, down, left, right). Movement should be smoothly transitioning from one tile space to another. The player begins in the tile ‘W’ on the map layout.
The user must be actively holding the movement key for movement to occur, otherwise movement stops (when it reaches the next whole tile). The wizard may only stop movement on a whole tile space, not part-way between tiles.
The wizard sprite should change depending on the direction they are facing:
The wizard can shoot fireballs by pressing the space bar. Fireballs travel in the direction the wizard is currently facing, until they hit an object. Fireballs can destroy brick walls, triggering the following animated destruction sequence:
with each image lasting for 4 frames. This absorbs the fireball.
After a fireball spell is cast, the wizard must wait for their mana to recharge as shown with a progress bar in the bottom right-hand corner of the screen. Different levels may make it more difficult or easier for the wizard to cast spells (cooldown is specified in the config per level).
The player’s movement speed is 2 pixels per frame. Fireball speed is 4 pixels per frame.
Gremlin enemies are green mischievous figures. It has the character ‘G’ in the map layout. When hit by a wizard’s fireball, it will disappear and respawn in another empty area of the map, at least 10 tiles radius away from the player (in the process, absorbing the fireball). Each gremlin throws slime projectiles in the direction of their current movement, with a frequency in seconds specified in the configuration JSON for that level. If the gremlin hits a wall with more than one possible new direction to go in, it will randomly choose a new direction but won’t go back the way it just came.
If the wizard comes into contact with a gremlin or its slime, they lose a life and the level is reset to its original state. If the wizard’s fireball hits a gremlin’s slime, the slime absorbs the fireball, and in the process is itself vapourised.
Gremlin movement speed is 1 pixel per frame and slime projectile speed is 4 pixels per frame.
A powerup is an item that can be collected by the player upon moving to that location on the board (player character collides with it directly). You should decide a new symbol to use in the map layout config to denote a powerup. Please be creative in designing the sprite for the powerup you decide to implement. The functionality could be any one of the following things:
Please ensure that the duration of the timer remaining is made clear to the player. (maybe there is a counter in the top bar, with the name of the powerup’s effect. Or, a progress bar like as in the spell cast cooldown). You should determine the time interval it lasts for (maybe around 10 seconds is reasonable).
You may also choose to implement a sound effect when the powerup is collected, and choose to animate.
The powerup should not spawn immediately when the level loads, but only after some delay interval (within 10 seconds). And when collected, it may respawn after another randomised delay interval, with this process continuing. You may choose to implement multiple powerups and choose which one to randomly spawn in. Note that the powerup system must be able to work with all map types.
The current level is completed when the player reaches the exit. If there is another level, that level is then loaded with the player starting in the position defined in the map layout. The player retains the number of lives they had previously.
If there are no more levels and the player wins, display a screen saying “You win”.
If the player loses all of their lives, display a screen saying “Game over”.
Any key press from either the game over or win screens should restart the game.
Your application will need to adhere to the following specifications:
You have been provided a /resources folder which your code can access directly (please use a relative path). These assets are loadable using the loadImage method attached to the PApplet type. Please refer to the processing documentation when loading and drawing an image. You may decide to modify these sprites if you wish to customise your game. You will be required to create your own sprites for the powerup and any extensions you want to implement.
The extension is worth 2 marks maximum. For an extension, you can choose to implement: