Sign in to follow this  
  • entries
    298
  • comments
    1135
  • views
    231358

Speedy progression!

Sign in to follow this  
HopeDagger

133 views

Gotta rush, gotta rush! Just 7 days left! Thank goodness the deadline for the contest is at 11:59PM on June 30th, thus giving me virtually an extra 24 hours!


Refactoring

What project is complete without its own share of tedious refactoring? Today I realized a few follies in my code design, and shifted some logic around. For one, sprites (sprites==entities=='things') are now created from a set of 'sprite templates', rather than generated from a hard-coded list every time one is created. This set contains things like: the player, enemies, fruit, and doors. The 'Sprites.txt' file in my Data\ folder resembles:

04,16,16,Blue Bounder
04,16,16,Red Bounder
00,16,32,Boxman
00,16,16,Roller
00,16,16,Spikes
00,32,32,Croc-Man

The first field is the ID of the sprite template (zero being a non-template, generic sprite), and the next two are the width/height of each frame in the animation. The last being both the sprite's name and filename; coincidentally paying homage to Java's equally restricting naming style. :P

I also formed an AddList and DeadList, for adding and removing sprites from the game. Since I can't directly modify a list while I'm in a foreach() loop, I toss to-be-destroyed and to-be-added sprites in their respective lists, and they get added in the next iteration of the game loop. Is this elegant enough? I'm no optimzation buff. Feedback is good. :)


Foes!

I added the (arguably) most basic foe there is: The Bounder! This little fellow jumps up and down in whatever direction it's facing, and reverses directions upon hitting a wall. These squirts come in three flavours: green (jumps a medium amount and moves at a medium speed), blue (jumps really far at a fast speed), and red (jumps really high very frequently). I figured I'd take the multiple enemies per-AI approach, since time is in low supply. Not only is it easier, but it still looks pretty cool! Here's a shot from the map editor whilst making my little test-map:



(The editor's viewport is 50% the actual game screen, for ease of use)





Points! (and HUD)

I implemented the "points" system today, which is essentially a trivial accumulation of values by collecting fruit sprites and other tasks. As trivial as it might seem, when I grab an apple and I see some flashing numbers appear and fade up into the air...well, it just feels good!



(Points++)



Also shown here is the HUD/status-bar, which currently shows points (functional), lives (non-functional), and tomato(e)s left (non-functional) in a cool semi-graphical fashion.


Overall

Overall I'm very pleased with how the game is coming together. Granted I only have one week left until I need to finish it -- so stress is a factor -- but I'm surprised how easy it's been to toss together a game in C# -- a language I've never made a game with before -- and SDL.NET -- a library I've never used before. The other cool thing is that there's been zero speed issues. The game runs wonderfully, and I haven't even optimized that much of the drawing!


An Extra Gloat

Oh, and I apparently have won two awards at my highschool. The "Computer Science Award" which is "based on your outstanding achievement in Computer Science". And, to which I feel particularly humbled: the "Eric Knabe Memorial Award" which honours my late CS teacher, and was given for my advocating of technology and helping others, to be presented by his wife. Mr. Knabe was an awesome teacher who taught CS at my highschool for many years, and helped form me become the programmer I am today. I feel very flattered for receiving both. :)
Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now