Share your repls and programming experiences

← Back to all posts
Super Hexagon Clone
mwilki7 (1104)

I've been dying to work on something other than my previous project, and I've been meaning to try this for a while now. This took me 2 and a half days.

If you aren't familiar with Super Hexagon
(https://www.youtube.com/watch?v=2sz0mI_6tLQ)
You dodge shapes coming towards the center of the screen with the left and right arrow keys.

and that's it!

Some extra levels to paste in the textarea:
https://pastebin.com/tHZuq01T - JSON text to paste into the textarea

Editing your own Level:

If you want to change the level see the level1.json file:
"level_shape": [3, 4, 5, 6]
Only choose numbers between 3 and 6, these are the shapes the game will automatically switch between (3 - triangle, 4 rectangle, 5 pentagon, 6 hexagon)

"level_colors": ["black", "mediumblue", "green", "gold", "red"]
Use exactly 5 colors, these are the colors each level is

"level_speeds": [10, 12, 14, 16, 20]
These are the speed of the shapes you have to dodge.
Level 1 moves 10 units per frame
Level 2 moves 12 units per frame
etc...

"level_rotation_speeds": [1, 1.2, 1.4, 1.6, 2]
Each of these is the speed of the rotation of the level at each level (don't make yourself sick :s )

"level_music": "music/FantomenK_TheMassacrev2"
The music played in the level

I have put 3 for you to choose from:
• "music/FantomenK_TheMassacrev2"
• "music/Bossfight_MilkyWays"
• "music/Bossfight_TheMazeOfMayonnaise"

"player_speed": 12
How fast the player rotates around the middle

"fps": 60
I forgot to check for this in my last project, my monitor runs at 144hz so I needed to slow it down since most monitors run 60hz (otherwise it looks like slowmotion)
If you have a 144hz monitor, set this value to 144hz, but you may need to change the speeds of everything

If you want to add your own music, feel free to clone it and put your music in the "sound/music" folder

Adding your own obstacles

See the "obstacle_list" in the json file:

"type": 6,
"shape_list": 
[
    {"side": 0, "width": 50, "spawn_offset":   0},
    {"side": 1, "width": 50, "spawn_offset":  50},
    {"side": 2, "width": 50, "spawn_offset": 100},
    {"side": 3, "width": 50, "spawn_offset": 150},
    {"side": 4, "width": 50, "spawn_offset": 200},
    {"side": 5, "width": 50, "spawn_offset": 250},
    {"side": 0, "width": 50, "spawn_offset": 300},
    {"side": 1, "width": 50, "spawn_offset": 350}
]

"type": 6 - This obstacle will only show up while the level is a hexagon (6 sides), set it to 5 for pentagons, 4 for rectancles...etc...

{"side": 0, "width": 50, "spawn_offset":   0},

side - What side the polygon this spawns on, it must be smaller than "type"
width - How wide the shape is
spawn_offset - How far away from you it spawns

Notice in my example spawn_offset keeps increasing by 50, and how the side increases by 1, this makes a spiral obstacle.

Feel free to try messing around with the json file.
Feel free to clone this and do whatever you want with the code.

Sources:
Music: FantomenK, Bossfight
Libraries: CreateJS (for sound), JQuery
Terry Cavanaugh: For coming up with the original idea of Super Hexagon
Code: 99% percent of the code is mine (I have some small snippets of things I needed from stack overflow)

Commentshotnewtop
PYer (3466)

What the heck? Why doesn't this have more upvotes?

mwilki7 (1104)

@PYer
maybe competing for space on the feed with language jam submissions

DungeonMaster00 (131)

include the ability to have custom music.

the music is great

edit: i recognize two of these songs from geometry dash

MarcusWeinberger (585)

This is a super cool game

RolandJLevy (498)

Hey @mwilki7, this is such a cool game. I found it really difficult to play but it's really well coded - well done!

uhmansoori (46)

Very cool project. I also liked your Canvas game project. Very intuitive and could also be improved over time. 😁👍

JosephSanthosh (1192)

Nice! I love your program, profile, and picture

dontbanmeplz (2)

The graphics are really trippy

mwilki7 (1104)

@dontbanmeplz
the graphics on the real game are even more trippy