BOOMan!

I’ve had some free time at work lately and as I don’t like to just sit and do nothing, I was coding this little html5 game. We, with colleges got the idea of making our own bomberman a while ago. Main idea was to make a multiplayer version out of it using html5 and nodejs. This idea sat in my mind for

So the booman is basically bomberman, just in html5 + jquery. It’s still a single player game and isn’t as good as I’d like it to be, but it’s working.

Little about it:
- ~750 lines of js
- took me around 2 weeks, after the work development time to create
- everything is written in OOP style, so all the things are objects which have their own properties and methods
- Game update and draw functions are called every 50ms
- Input is handled using queue system. All keystrokes are put into an queue which is handled on the game update. This should give pretty responsive gameplay.
- Sprites are drawn using jCanvas. Source images are .png (I know it’s bad, but I needed the alpha channel)
- It has no levels, so after blowing all the blocks up there is nothing else to do.
- It’s missing sprite pre-loading, so you might see some flickering with the images.
- It is possible that you spawn on a wall and cannot move, either blow yourself up with the wall or just refresh to get new map

 

Click here to try!

Direct demo link
Direct demo link for the first release (to see the difference :p)
Github

All the credits for tiles and the character go to Klex1992 on rpgmakervx.net

Tagged with: , ,
Posted in javascript / jQuery

Me vs As3 ExternalInterface.addCallback()

I struggled a while today to get this working, but with the help of guys from irc.freeNode.net ##flash (thanks Amis) I figured it out.

So what’s ExternalInterface.addCallback() anyway? It allows JS to communicate with AS3, simple as that. It creates an function to the flash object which you can then call from javascript. Meaning that you could basically move your gallery using JS instead of AS3.

What was the problem?

I was unable to call the function I set in the AS3. I was getting

from jQuery and

from javascript.

This is the code I have in my main.as, in the constructor function:

 

Possible solutions

1. You are missing this important line

This line allows JS <-> as3 communication. “sameDomain” should also work.

2. Your flash function waits for an argument but you aren’t giving one in the JS. Just be sure the argument count match.

3. Your addCallback never gets called, be sure that it is getting called. Put it in a constructor for an example.

4. You are selecting the wrong object / element with javascript. When publishing from flash, it generates code with 2 flash objects in it. One for IE and one for other browsers.

Be sure to select the correct object, I was selecting the one for IE but that one didn’t have the function I was searching for.  If you are also using the Flash generated code with 2 objects and jQuery, you can use this snippet:

 5. You are selecting the right object with jQuery but still doesn’t work?

As jQuery returns an jQuery object rather than the DOM element, you need to use .get() to get the DOM element which has the function you defined in as3

Tagged with: , , ,
Posted in Actionscript3, Code

Found a theme!

So I chose this great theme called Responsive

I was browsing some random themes on the WP themes section and this was the only one my eye stopped on (I did only look through about 50 themes). It’s light, easy on the eye and well written. I’ve already modified it and I’m continuing doing so, but I just wanted to say thanks to the guys at http://themeid.com/forum/ for their excellent work.

Posted in Other

Why wordpress?

Because I felt like it. When I was thinking about writing a blog, wordpress was the first one on my mind. I won’t say it’s THE BEST, but it’s probably one of the best blog tools out there.

It has everything I need and I didn’t really feel like writing my own blogging tool. Also I’ve written some WP code in the past so I know my way around here. Though before I’ll get into any serious blogging I’ll need to make this place comfortable for myself and for the readers.

Things I’ll surely need:

  • Nice and clean template. No ads, no blinking texts, no oversized containers. Just everything that is important.
  • Great code highlighter. I’m going to paste A LOT of code into this blog. It needs to be accessible, easily readable and formatted to my liking.
  • All the other things that doesn’t come to my mind right now
Posted in Other