Posts

Showing posts from September, 2012

New blog domain: kula.blog

It's still work in progress but new posts will be published on  https://kula.blog/ Thanks to 11ty base blog RSS is working from the start so it should be easy to add to your reader if you still use any :) If now then I hope you can sign up to the newsletter where I'll be publishing new posts and interesting articles to it from time to time. Please use  kula.blog  from now on.

My Game: Canon Defense

Image
If you know about #js13kgames contest you might be interested in my small game created for it. I called it Cannon Defense, but the sole purpose of creating it was to learn in practice how to create a game. You can say that it looks ugly, or is small, but for me it was great co create it. My submission is not yet online so if you want, play it at:  http://krzychukula.github.io/js13k/ Code is on github:  https://github.com/krzychukula/js13k What I have learned: User constructor and prototype inheritance for game objects. function Bullet(x, y){ this.x = x; this.y = y; } Bullet.prototype.draw = function(ctx){ ctx.drawRect(x, y, 10, 10); } It will be more memory efficient. Do not use translations to move objects For me it was hard to manage bullets flying at various angles and the first idea was to translate all bullets to cannon position, then add some offset variable and just move bullet on one X or Y angle using offset. It worked :) Until I had ...

How to simulate slow connection (developer proxy in Node.js)

Image
Update: If you use Chrome then you can use "Throttling" so simulate slow network for all your assets. This should be easier than proxy. Toggle device mode   Choose Network type. Refresh the page https://developer.chrome.com/devtools/docs/device-mode  Proxy: For some time I wanted to use some proxy for development and testing of eg. slow internet connection, but it was hard to find something useful and free. I know there is Charles but buy it to use it at most one in a month is not for me. I started thinking about Node.js, maybe I can write proxy for me? But fortunately I found one. https://github.com/nodejitsu/node-http-proxy With this module I can write really short code to create slow server: var http = require('http'), httpProxy = require('http-proxy'); httpProxy.createServer(function (req, res, proxy) { var buffer = httpProxy.buffer(req); setTimeout(function () { proxy.proxyRequest(req, res, { host:...