Breif Intro
Player control a hero to collect as more coin as possible while keeping away from the moving enemies... Github: https://wswsws125.github.io/MSTU5003Project/ Game Demo: https://youtu.be/NVztM-TBVuU Aesthetic Decision: I want to make a game with simple interface and figures. Because the simple figure gives me a natural and peaceful feeling. Sometimes I get bored with some games with complicated graphics and gameplay. But I find it easy to get fun from some simple games, for example, WeChat app where a small person jump when you long press the screen. I think this game brings people a lot of fun in their busy lives. That’s why I want to design a casual game to let people take a break from the busy real life. Development: html/css are simple. For the js part, I use Processing (a great software for visual art design. Its functions are almost same with p5.js) and use a processing.js to compile the code into javascript. The classes and functions are listed below. Functions:arrow key control, collide detection (eat gold or bettacked by enemies), randomly gold refresh, hp increase/ decrease, froze everything when game over, record high score, click to move everything and start the game again. Classes and Functions Player variables float location x, location y; int hp, gold, speed, PImage img; functions Move by keys, eat, inCanvas, + void display() // draw the hero + void move(Wall[] walls) // move the hero by arrow keys, keep him in canvas, not go into walls + void hpUp() // add 1 hp, keep hp <= 10 + void hpDown() // minus 1 hp, keep hp >= 0 + boolean eat(PVector pos) // check if the hero eat the food, if so gold+1, hp+1 + boolean beAttacked(Enemy[] enemyArray) // check if the hero collide with the enemies, if so hp-1 Enemy extends Player variables int speed, xspeed, yspeed, garvity; functions + void move() //move the enemy + void display() //draw the enemy Wall variables float x; float y; float w; float h; functions + void display() //show the walls Main Global variables Player player; PVector food; Wall[] walls; Enemy[] enemyArray1,enemyArray2,enemyArray3,enemyArray4,enemyArray5; int scl=30, recordScore=0; PImage gold, gold1; functions + void drawStatus() //show the status bar + void pickLocation() // pick a random location of food + boolean inWall(Wall[] walls, PVector pos) // check whether the food is in wall + void resetAll(Enemy[] enemyArray1,Enemy[] enemyArray2,Enemy[] enemyArray3,Enemy[] enemyArray4,Enemy[] enemyArray5) //move all the enemy arrays + void stopAll(Enemy[] enemyArray1,Enemy[] enemyArray2,Enemy[] enemyArray3,Enemy[] enemyArray4,Enemy[] enemyArray5) // stop all the enemy arrays + void reloadScore() //record the highest score in a .txt file + void gameOver() //froze all characters, show information on a score board, click to restart
0 评论
写评论。 |
Can Zhang(The pic is my cat.) |