Java Port Dev 1

First step of progress!

Today I beat Minicraft, and decided I wanted to port the game to JavaScript! (Note: Java and JavaScript are NOT the same thing!) This would allow the game to run on mobile devices lacking Java. I downloaded the source of Minicraft and started thinking about what I needed to do.

I was easily able to trigger the in-game sounds by using the nice HTML5 audio tag.

Sprites would be a bit more tricky, because I would need to express any color for any image. For example, slimes can be found with 4 different color schemes. To do this, I made an alpha PNG mask for each sprite layer on the sprite sheet. I created several colored square DIV elements (red, green, and blue as a test), then used the PNG as a webkit mask for each. Using the -webkit-mask-position property, I was able to select different parts of the sprite sheet to use as a mask. The image on this page shows the different shapes with different colors!

I will work on this project more soon.