JS13K Games 2019 Day 20

Life just kept me away from the keyboard, so I'm really going to have to kick this in high gear if I want to have a working project by the end of the competition.

I do have some good news, I got FireFox installed for testing and I found a really good snippet of code: jfriend00's docReady code will allow me to have a "$('document').ready(function(){});" without having to add jQuery.  Remember, I have to keep my game under 13K in a zipped folder.

My test to see if docReady would work, was to get the Canvas to resize to the available browser screen size.  I found a w3School webpage on window's innerheight and innerwidth, but those would be WAY TOO BIG for the screen.  I then tried document.body.clientWidth and document.body.clientHeight, but I got the same result.  As I was playing around with Chrome's Developer Console, I found document.body.offsetWidth and document.body.offsetHeight; which, gave me the window's Height and Width that were currently view able.  That was exactly what I needed!

Wait...it's broken in Firefox.  I found a way to detect Firefox, now I just need to find another element and attribute that will get me what I need in Firefox.  Thankfully, document.body.offsetWidth still works, so I just need to fix that height!  Wait...after putting document.body.offsetHeight in a variable and using it later in the code, it breaks for all the browsers!

I was going to try to get a solid Frame Rate going, but that bug appeared and it's technically the next day.  I'll see what I can do later.

Comments

Popular posts from this blog

Game Off 2019 Day 4

Hacktoberfest 2019 Day 8

Metroidvania Month 7 Day 6