Jump to content

  • Log In with Google      Sign In   
  • Create Account





Getting to know the Canvas

Posted by DareDeveloper, in Project Ideas 02 April 2014 · 354 views

Canvas HTML JavaScript Tetris 2048
I am familiarizing myself with JS and HTML5, Canvas first ... not WebGL yet.

The first thing I am trying to do is programming what I had in mind when I heard that there is a combination between Tetris and 2048.
Not sure if the game mechanics will make a lick of sense, but I want to know what it feels like.

Working Title: NPAA (Not Proc At All)

I have not managed to keep the code clean, so I will have to refactor soon.
I also need to look at articles about object oriented programming in JS.
What I have so far are procedures, procedures, global constants and variables and ... procedures ... and already the if/else statements annoy me.

So far I can cycle through the different block types and their rotations (with the arrow keys).
The delayed response to the user action is a feature, not a bug btw. Posted Image
In the actual gameplay the response will be immediate.

The next step will either be writing some ugly gameplay logic ... or researching and refactoring.

Posted Image




oh yeah, JS OO is funky. Here's what I settled on: http://tnovelli.net/ref/js.html#oop

is that page that's linked to supposed to do something?

is that page that's linked to supposed to do something?

As soon as you click on the canvas the main program is running ... then the mentioned features should work:

... cycle through the different block types and their rotations (with the arrow keys) ...

oh, arrows keys. I missed that

oh yeah, JS OO is funky. Here's what I settled on: http://tnovelli.net/ref/js.html#oop

 

I actually think that is good stuff ... finally I can create two blocks :-)

Probably hard to figure out, though ...

 

Moving on to gameplay ... and maybe some more refactoring.

oh, arrows keys. I missed that

No bug then? Phew.  Thanks for checking it out! :-)

PARTNERS