Arrow keys for movement and crouching, spacebar to jump. Use arrow keys while swinging to increase his spin. Hold down spacebar to make the jump last longer. Hit spacebar again when holding on to a wall to wall jump. A is punch and D is kick. Click on the game to start interacting with it
Hello!
Long time no see. The thing is, as with many other people, it seems I can only work properly on my personal projects when I don't have enough time. As soon as I get a weekend, or a holiday, which I've been anticipating as a wonderful opportunity to get on with it, I find myself suddenly afflicted with accute laziness. It's the stolen hours between obligations that have the highest yield.
Anyway, all that to justify the apparent lack of progress, but don't you worry, I've been keeping the project on a simmer, and I thought I'd share what I've done so far.
As I said in my previous post, I wanted to get on with the fighting system. I knew this would be a lot of work, but I still didn't realise quite how much. Several little niggling problems turned up, of which more in the geek section later.
Anyway, as you can see, Dreg can now punch and kick. So far I've done a three punch
combo, a single kick, a flying kick (which fighting purists among my friends say simply does not exist in real martial arts, but this is a computer game!), uppercut and a low kick. I plan to add several more in the future, with all sorts of silly combos. I'm quite happy with the way I've set the combat up, because it makes adding moves, and combos, very easy. Now I "just" need to animate them.
Also, seeing as I wanted low attacks, I had to make Dreg crouch. That meant I also had to animate, and program, him crawling. All this silly work!
Anyway, for now, all you have to practise on is a yellow rectangle. But it's there to show that it reacts to your hits, so I have the collision detection sorted. It also reacts correctly with the world collision lines, and gravity rifts, of course.
Don't worry, there's still more for me to do. This is the plan:
- More moves! Especially fun little combos. Also, it'd be nice to have a different jump kick depending on whether Dreg is moving sideways or not...
- The big one: Throws. This means intricate character interaction which I need to have work so that it looks like the character is being held by Dreg, but that also the character continues to perform collision detection on the scenery. I have a few ideas how to do this, but I'm worried about it.
- Maybe I could try improving on the enemy character design. Not that I have anything against yellow rectangles...
- after all that, I have to go through the same process for the enemy as for Dreg - animating movement and fight moves.
- The HUGE one: programming enemy AI. urrrrgghh! Only second to collision detection in the head-ache department.
Time for the nitty gritty:
< geekology >
First, for those who care, some silly statistics!
So far in the game, I've got 24 classes, though some of those inherit from others, and aren't particularly complicated.
The biggest class, Character, is currently at 961 lines, though that's including blank lines, braces and comments. It has 26 functions, excluding getters and setters (some of which are quite complicated) and it inherits from another class (MovingObject) which handles things like gravity shifts and whatnot. It's a bit of a mess.
So far, Dreg has 428 frames of animation, which is to say about 17 seconds, seeing as the game runs at 25 fps.
I have 65 symbols in the library (including various parts of Dreg, and level decoration).
The compiled .swf file is 116 KB big. I should write a preloader soon...
As for the work I've done so far, I had a couple of issues here when it came to gravity rifts. In a previous post, I mentioned that as Dreg passes through a rift, he is simply added to the new gravity zone sprite. The problem with this approach, now that I have multiple characters (yes, the yellow rectangle is a character) was that depending on the relative positions of each gravity zone within the level display list, and depending on when characters entered each gravity zone, Dreg would sometimes end up behind, and sometimes in front of the other character. My solution was to have each character placed in his or her own container sprite, which was added to the level in the order of my choosing, and when a character entered a new gravity zone, the container sprite's coordinates would be set to those of the new zone. That made so much sense I feel all nice and warm inside.
I also had to sort out a system to allow punches and kicks to register
through a gravity rift...
I'm increasingly starting to embrace what I used to consider bad practice - that is to say, coding within a MovieClip's timeline. But that's exactly what I'm doing with all the fighting animation - the variable which defines the next move in a combo, as well as the function which does a collision test when Dreg punches, are all done within the timeline. I think it makes sense, seeing as these actions are all dependent on Dreg's current frame (it only checks for collision at the frame that Dreg's arm reaches out the furthest, for example...). It might come back to bite me in the bum when I get confused about where a certain variable is being set, but I'm hoping it'll all be fine!
</ geekology >
Anyway, hopefully the next installment should be more graphically pleasing...