edwarddunn / platform-game Goto Github PK
View Code? Open in Web Editor NEWJavascript/HTML platform game
License: MIT License
Javascript/HTML platform game
License: MIT License
I recently tried to scale down the canvas a bit, but that was an epic failure even though I changed the 400 to 375 at all places. The jump control which depended on it froze because of it. I feel code will be easy to update further changes if it is refactored with named constants in place of raw ones.
Bonus Obstacles
Currently the game only consists of jumping over enemy characters, the longer you stay alive the higher your score.
An additional feature could be to have bonus obstacles appear with the enemy characters, if you jump on them you get a certain amount of points added to your score.
If you need help or have any suggestions, just leave a comment.
Occasionally the controls (keys and buttons) stick in one direction. It is very intermittent but it can sometimes be reproduced by quickly pressing a range of controls when the game first starts.
Hello
This is a nice project, I'd like to try to help with it.
I noticed there's a key to disable music but no key to disable sound. And the jumping sounds might be a bit annoying to some people. It'd be nice to either add a key to disable the sound effects (for example 'e') or attach this to the 'm' key so that disabling music also disables sound effects.
If you think it's a good idea then I can try to implement this.
Lots of things in the code can be fixed, just seeing a startlevel2, startlevel3, 4 and 5 is horrible. The moment you get a lot of levels this becomes horrible to maintain.
I would suggest trying to turn that into one function. There's also parts where objects would be better than arrays.
Putting everything in one file also makes it pretty unorganized. So I would suggest trying to split it into core parts.
Create 4th Level
Currently there are three levels in the game. Add a fourth with a new background and enemy character.
The level is created by adding a new level function in the Game.js file (See startLevel2() function as an example).
Remember to add a new if statement for startLevel4() in the UpdateGameArea function
if (gameArea.frameNo === 3000){
gameArea.stop();
currentLevel++;
if(currentLevel === 2){
startLevel2();
}
else if(currentLevel === 3){
startLevel3();
}
else{
gameComplete();
}
}
Any suggestions or issues, just leave a comment!
when jump button is pressed,the main character(hero) flies and the character comes down only when the button is released.I think there should be some time constrain for which the player can stay up in the air
Add new enemy character to the game. This can be anything but it would be advisable that the size
is similar to the existing characters.
Animate player characters
Currently the main characters are just single images. It would be good to animate the character so that when they move their position changes e.g. in a running stance. Currently there are two different player characters in the game for levels one and two. The images have been taken from sprite sheets available at;
http://www.gameart2d.com/temple-run---free-sprites.html
http://www.gameart2d.com/adventurer-girl---free-sprites.html
These sheets have lots of other stances of the character that could be incorporated in to the game.
If you have any questions or suggestions just leave a comment.
Hi guys, just a little suggestion.
For the sake of making the code more easily to read and manipulate, you could create an Object to store keys which represent values, in this case, to store the keyCode for the Arrow keys (UP, DOWN, RIGHT, LEFT)
Something like this:
`const keys = {
UP: 38,
DOWN: 40,
LEFT: 37,
RIGHT: 39
} `
So, in order to invoke any value within the keys Object you would use
` switch ( //validate stuff here) {
case keys.UP:
// Crazy-amazing-smoked-mind-bending stuff here
break;
case keys.DOWN:
// U wot m8
break;`
And so on
All of this is just for sake of making it easier and more readable code, since I've worked with Canvas before and also did a mini-minuscule-game.
Good luck guys, amazing work so far!
Add a feature that will allow the user to use the on screen buttons or the arrow keys on the keyboard to move the character. Currently the user can only use the on screen buttons.
Visit this page for an example on how to do this - https://www.w3schools.com/graphics/game_controllers.asp
The current docs (README and CONTRIBUTING) could use an overhaul to make them easier for newcomers to read. Also, Contribution_Guide.md should be named CONTRIBUTING.md for consistency.
Creating new level with multiple enemy with multiple skills and new player character would be good enhancement to game
i would be happy to contribute to this if you allow me to @EdwardDunn
Exploding Obstacles
A good addition to the game would to have objects that appear in the same way the enemy characters do, but these objects give you extra points to your score if you jump on them.
These objects could also explode to show the player has successful hit them.
If you need any help or have a suggestion, just leave a comment.
The name of The Jumping Dead has been chosen for the game. To illustrate this a banner needs to be created and displayed above the game screen.
Feel free to experiment with the image but try to make it fit in with the game. This task is specifically to create a good banner so try and be imaginative.
If you have any questions or need help just leave a comment.
Create Play Button for Instructions Modal
Currently the instruction modal is using the restart button image for starting the game
Create a new Play button, you can use the existing button images as a template. These can be found in the pictures folder.
Just leave a comment if you have any suggestions or need any help.
Highlight Bonus Score
A new feature recently added allows the player to kill enemy characters by jumping on them. As a bonus, the player gets 100 extra points added to their score.
It would be good to highlight this bonus. Make the score light up (change colour) for a few seconds to show the player has received the bonus.
If you have any suggestions or need any help just leave a comment.
The file bgnd_mus.wav doesn't loop properly, you can hear a little silence at the end of it.
I am working on it.
Maybe i could change the music itself, i find it quite annoying at long?
New Name
It would be good to give the game a name (rather than just platform-game).
Leave a comment if you have a suggestion or if you like someone else's suggestion.
Adding a config file with settings would greatly increase readability in the codebase.
You could add controls to this file and the starting situation of every game.
Hello, I like to play my own music when playing games. So I implemented a toggle music key. Also I was also working on a way to pause the game, however a pause feature is already implemented but I did not know due to no instructions. I added some more instructions at game start to pause and toggle music.
The images bad_guy.png, enemy2.png & good_girl.png are accessed by "Pictures/.png", when they are actually located in the "pictures" directory. Hence, these images are not visible. Can I make a change to move the images to the correct location so that they are visible?
Currently there are two levels in the game. Add a third with a new background and enemy character.
The level is created by adding a new level function in the Game.js file.
Remember to add a new if statement for startLevel3() in the UpdateGameArea function
Any suggestions or issues, just leave a comment!
Pause music when game is paused. I think that's a good idea.
Great for beginners!
Add a summary of the project (as comments) at the top of the JS_Game.html page
I have marked where it should go at the top of the page
It would be good to have sound effects for the movement of the main character.
Sounds
Please only use copyright free music/sounds, and update the copyright file with the sources.
The first level completes when the score counter reaches 11000, this is too high because it takes a long time to get to this score. Reduce this to 5000.
This is the code that stops the game once the score counter reaches 11000 (in script.js file).
//when frame number reaches 11000 (point at which obstacles end) end game
if (myGameArea.frameNo == 11000){
alert("CONGRATS YOU HAVE ESCAPED ALL THE BAD GUYS, PHEW! PRESS START TO TRY AGAIN");
myGameArea.stop();
}
Just change 'myGameArea.frameNo == 11000' to 5000.
When you die at a level higher than 1 and then click restart, it starts again from the first stage. However, the level display on the top right does not re-update to 1. I'd like to fix this! ๐
Add animated background
Currently the backgrounds is a still image, it would be good if some parts where animated. An example of this would be to have moving clouds or rain. This could be done by adding extra components into the game, or you could look for copyright free backgrounds that already have some kind of effects.
Try changing the level 1 background first.
If you have any suggestions or need any help, just leave a comment.
Player Moving After Restart Button Pressed (Intermittent)
There is an intermittent fault with the restart button, when pressed in quick succession the player character continually moves to the right.
A way to replicate this bug is to end the game by hitting an enemy character, press restart and then quickly hit an enemy again.
Add New Level
The new level can be similar to the first but perhaps changing the background and enemy images would be good. Also make the game harder in some way, maybe by increasing the speed at which the enemies approach at.
The new level should start after the player successfully completes the first level.
This is the code that shows completion of level 1.
//when frame number reaches 11000 (point at which obstacles end) end game
if (myGameArea.frameNo == 11000){
alert("CONGRATS YOU HAVE ESCAPED ALL THE BAD GUYS, PHEW! PRESS START TO TRY AGAIN");
myGameArea.stop();
}
Instead of displaying the message, open the new level automatically.
Add Enemy Killed Sound Effect
Currently when the player character jumps on an enemy character, the enemy dies. However, there is no sound effect for this.
Add a short sound clip for this. Make sure any sounds used are copyright free and add their source into the copyrights.txt file.
If you need and help or have a suggestion, just leave a comment.
The game can only be restarted and not paused right now.Hence, I would like to take up this issue so that the game can be paused.
Enhance Player Character Jump
Currently the player character moves around the screen fine. However the jump function is still a bit slow and laboured. It would be good if it was more like other traditional platform game character jumps.
Watch this video as an example of what i mean.
https://www.youtube.com/watch?v=Q8ivkP-qs04
Any questions or suggestions just leave a comment.
Currently on game over a standard alert box displays with a message. It would be better to have a custom message that displays on screen and prompts the player to try again.
Tasks
Please just add a comment with any questions or suggestions.
Change the gravity value to make the main character fall faster after jumping.
This is the value to change in the JS_Game.html file
this.gravitySpeed = 3.5;
I'll be adding a PR for the game won sound. It's a bit quiet, but better that than nothing, I suppose. The sound effect: https://freesound.org/people/Mativve/sounds/391539/
Currently the main character can be moved off screen, this makes the game too easy because the player can keep the Jump button held down to constantly avoid the enemies.
Task
Game Instructions Modal
When the game first opens it would be good to have an html modal popup with some instructions on how to play the game, like the following.
How to play the game
Controls
If you need help creating a modal this is a good reference
https://www.w3schools.com/bootstrap/bootstrap_modal.asp
Today when I reached level 4, there are no enemies are character on screen. And the score will just keep increasing infinitely. Also, is there a reason why the score keeps reseting when a new level is reached? I am thinking of tweaking this.
I think it would make the game more interesting if you could element the bots instead of simply avoiding them.
I will work on this code. and create a PR, if the project doesn't want to go this way just let me know.
I feel that the scoring scheme is kinda flawed in the sense that at the end of the game, the user does not get a total score accumulated through the entire course of the game. Also I feel like the score should depend upon the time elapsed + the number of enemies killed. My proposal is to change the levels to be for a certain amount of time (eg. 30 seconds), and add score as enemies are killed. Of course, the user will also be awarded points for surviving the duration of the level. Please assign this issue to me if you feel like there is some value in changing the design choice to this! ๐
Create Bonus Star/Coin Objects
Like in many old platform games, the player can gain extra points by collecting stars or coins.
Create a new component that works in a similar way to the enemy characters, but when the player character collides with them they get extra points.
The extra points should be shown as a star/coins total next to the level score. This is a new feature that will be used later to provide a leader board for players (rather than just getting to the end of without dying).
If you need any help or have a suggestion just leave a comment.
Enemy Killed Animation
Currently when the player character jumps on an enemy character it falls off the screen.
Create an animation that makes the enemy character explode instead of falling away every time there is a collision.
There are a number of JQuery plugins to help with sprite animation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.