Submit templates for here.

← Back to all posts
Simple platforming template

This is a very easy to use platformer base, entirely made by me!!

So all you need to do to use it is look at the top of the script.js file for the arrays, numbers in these brackets [], and look at the easy o understand names of them

Platforms array

The array called platforms is, you guessed it, the positions and sizes of the platforms! The platforms are equal to 4 numbers in the array, the 1st number is the x position, the 2nd is the y position, the 3rd is the length and the 4th is the height, so when deleting platforms delete all 4 numbers otherwise it will become very weird.

bounce array

This array controls where the bounce pads are and is layed out in the same way as the platforms array. 1st is the x, then the y, then the length and finally the height.

enemies array

The enemies array is done differently than the platforms and bounce array as each enemy is only 3 values! The first is the one you change depending on the platform size that the enemy is on, the higher the number the smaller the amount of platform the enemy covers and the smaller the number the more of the platform the enemy covers!! I suggest fiddling about with this value until it stops just where you want it to! The 2nd value is the x position and the 3rd is the y.

backing array

This array renders the dark blue buildings in the background, this array only needs one value for each building, the distance from the roof it will spawn, the higher the number the closer to the bottom of the game it's roof will be, but the lower the value the closer to the top of the game it's roof will be.

coins array

This draws the coins on the map which you have to collect! It only needs to input values the 1st is the x and the 2nd is the y!! It gets a bit more complicated now as for the win screen to show properly you will need to change a small value in the code!!
So when you are happy with your coin placing go to the timer.js file and head down to line 21 and you should say an if statement

in the if statement on line 21 replace 23 or whatever number is at the position of 23 with the amount of coins in your game and tada everything is working and the win screen will show when you finish by collecting all the coins

Simple right??