A downloadable tool

Download NowName your own price

Bullet Hell Factory

A javascript module for turning videos into a playable bullet hell

Syntax:

new BulletHellFactory(canvas, video, playerStartX, playerStartY, playerSpeed, playerDisplayWidth, playerDisplayHeight, playerHitWidth, playerHitHeight, autoplay, colorLinks, killScreen)

Ok, that's a lot. I'll go through it piece by piece.


Implementation:

To use this module, download the file above, then import it into your main js file. You can the use the BulletHellFactory class to make your bullet hell!


canvas:

The canvas parameter is the html canvas element you would like to display the bullet hell on.


video:

The video parameter takes the html video element you would like to use for your bullet hell (later you will define what kills you based on color). Note that the proportions of the video will be changed to fit the canvas.


The video file can be any format that can be rendered on a canvas.


playerStart(X|Y):

The position where you want the player to start.


playerSpeed:

The speed of the player in pixels per second.


playerDisplay(Width|Height):

The width and height you want the player to be displayed as.

playerHit(Width|Height):

The width and height of the player's hitbox.


autoplay:

This is a boolean value that is false if you would like to have the killScreen (see below) be displayed after death (game starts again with x key), and true if you would like the game to automatically restart after death.

colorLinks:

This is where you specify what colors in the video do what. this is specified in the form of an array with key value pairs:

[
   ['rgb(0, 0, 0)', 'kill'],
   ['rgb(255, 255, 255)', 'kill']
]

the KEY is an rgb color in the form of a string, and the VALUE is a string with the action you would like that color to cause. currently the only supported action is 'kill', which kills the player, but I may add more soon.

Alternatively, adding new methods to the BulletHellFactory class yourself and then referencing them using their name in the form of a string in this array will make it call that function when the player comes into contact with anything of the color specified.

The array above says that black and white kill the player.


killScreen:

An html image element to be shown upon death.


Other stuff to look out for:

  • This is looking for the exact colors for collision, so if something is just off-white, it won't count it.
  • Sometimes, between a white and a black area in a video, there may be a small amount of grey, causing unintended collisions. this can be fixed by using a slightly different grey.
  • As with most bullet hells, when you press up and left at the same time, you will go up just as fast as if you were just pressing up, and left as fast as if you were just pressing left.This leads to an increase in absolute speed (sqrt(2) to be exact).

Download

Download NowName your own price

Click download now to get access to the following files:

bulletHellFactory.js 8.5 kB

Leave a comment

Log in with itch.io to leave a comment.