A Simple nodejs example of a sever that responds to post requests

A few years back I made a simple nodejs script that is a basic drop in script that can be used to start a simple static sever. I come back to the post now and then, and when I do I often edit the source code and the content a little. Anyway it is the kind of script that might not be a good choice to use in production, but when it comes to a simple pet project where I just want to host a public folder over the http protocol it seems to work okay thus far. Anyway the thought occurred that it would be nice to have another similar vanilla javaScript type solution for setting up this kind of script for a project only this time make it a script that is a slightly more advanced and will respond to post requests.

Read More

A game framework JavaScript example

This week I made another major JavaScript example this time it is a current standard game framework. This project is actually me using a whole bunch of different projects that I have made over time to create one massive central project of a javaScript example. The thing about this here is that I am getting tired of writing the same code over and over again each time I start a new project, which is often going to be the case when it comes to making the project a vanilla javaScript project. After all that term means I am writing all the code from the ground up rather than using some popular framework. So if I am getting tired of writing everything all over again each time I start a new project, but I do not want to use someone else framework, then I guess I just have to make my own.

As of this writing this game frame work has all the basic features that I would want to have in a game frame work at least. A must have feature of a project such as this would be a state machine which is in place all ready. On top of that there is a canvas module that supports layering, and an object pool that I can use to quickly create a collection of display objects.

Read More

Canvas Module JavaScript example

Many of my projects that I make involve working with canvas elements, and I also like to make vanilla javaScript projects where most if not all of the code is my own. Still I would like to stop making everything all over again each time I start a new project, so in todays JavaScript example post I will be going over a kind of canvas module that so far works okay for what I want to use such a module for.

There are at least a few basic features that a canvas module should have and one of them is to create and return not just one canvas element, but a collection of canvas elements. So the main create method of the canvas module should have an array of canvas elements as one of the properties. There should also be some additional features that have to do with attaching pointer event handers to at least one of the container of the canvas elements, or one of the canvas elements. There are a whole bunch of other features that might be a good idea also, for example one of my older JavaScript examples posts was on a draw points method, which I think should be adding into this kind of module.

Read More

JavaScript example of a grid module

I made a canvas example a while back on how to go about making a grid, but that post was more so on drawing one, not having something that is a state object, and methods that act on that state object. So then in this JavaScript example post today I thought I would go about writing about a simple javaScript grid module.
There are many basic features that a grid module should have, such as a public method that can be used to get a cell by way of a canvas pixel position for example. There are also more advanced features such as path detection that maybe should be a part of a grid module, or maybe a part of an optional module that can be used on top of a grid module. In any case for this example I am going to just be sticking with the very basics of this sort of thing. However do not let that fool you, even when it comes to the very basics of a grid module there is still a fare about of ground to cover.

Read More

JavaScript While Plant Grid idle game prototype example

This week I have been working on two projects that are additional game prototypes that might progress into some kind of final product. Today I will be writing on the current state of one of them that I am just calling wild plant grid idle for now. The general idea of the game was to just have a grid in which wild plants grow, and the player just harvests what is grown for points. These points can then be used to make improvements to the state of the grid.

So then this is yet another game prototype idea that I will add to the stack of my simple JavaScript example projects. Many of these projects are in various stats of completion, and this is one of them where I did not get as far as I would like to have in part because of time, and focusing more so on the other project that I was working on this week.

Read More