Peli is now able to fight. And can be killed. Give it a try. He can also pick up items (well, gold for now). Health and gold are now kept track of. I’ve also added some intelligent map rendering and a set of layers to the graphics subsystem so that the walls look better – it’ll be useful for other graphics as well. Also implemented updates vs. frames – so the animation/scrolling is smooth, even if there is only one sprite per character.
The enemies are some closely placed goblins that currently have a very stupid AI – they move/attack at random. They’re also pretty rich goblins and drop 5 gold every time they die 🙂 It took me a fair bit of effort to work out how to move/attack/die all in one turn and not look awkward. Hoping I’ve kludged my way to a fix for now.
My initial keyboard handling was really sticky, since it relied on browser specific keydown repeats. Yuk. Tried to fix it, but still not happy with behaviour when you have more than one key pressed. Oh well – more important things to get to!
About 5 hours worth of effort today, on top of a full day of work and some general confusion about finite state machines and animation/behaviour. Glad that’s done with!
Tomorrow is going to be making this more of a game – XP, levels, other items and other enemies. It’s probably better to get that done than have a fancy animation setup or shiny tileset. Probably.
Still pushing the code to bitbucket – if you fancy having a look.