Jump to content

- - - - -

Getting to know the Canvas


Canvas HTML JavaScript Tetris 2048
4: Adsense

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

Apr 03 2014 05:23 AM

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

Apr 04 2014 07:09 PM

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

Apr 06 2014 12:06 PM

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) ...

Apr 06 2014 03:42 PM

oh, arrows keys. I missed that

Apr 07 2014 03:43 PM

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.

Apr 07 2014 03:47 PM

oh, arrows keys. I missed that

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

Note: GameDev.net moderates comments.