Maps, Levels and Tweaks

Tweaking and refactoring the game components and adding the game levels.

Map editor

Mapping and level design has consumed me. There was no way I could do all this without an editor and so made one. Actually, I really enjoyed doing this and got slightly obssesed with it.

After many iterations I have and editor that I can load blank or load it with an existing level map. I can loop through the available tiles and map them to any of the 3 layers. I can also add my ramps, resize and reposition them and when complete It generates the data for the map.

One change I have made is to use 64x64 pixel tiles, mainly to make the data smaller.

My mapobject now has an array for each layer, ramp data and a list of interactive objects and their relative position for the object layer. My application manager can then render this data as a level.

Adding levels

Made the various components of a map reusable, so I can construct a level from one of a selection of backgrounds and foregrounds etc. I've added a splash screen for each and some 'get ready' and 'well done' messages.

Had an idea for a level based on E.T where my guy goes past the moon as they do in the film. It works but was a lot of effort, cutting up the moon and tiling it but looks great.

One idea I've had knocking around in my head for a while is a theme to the level in the form of something to jump over. Mostly sheep, cows, buses, not sure yet but I've added provision for an object to sit in between the ramps and I use this to focus my camera on when the level displays.

Stuff to jump over

Added an Animal class that is an PolyObject but in its own update method can walk up and down. Basically, randomly applies some linear impulse at different rates and or turns round the opposite way. To do this however I needed to extend my AnimationFrames class. I really needed to do this sooner or later as it was 'very' basic. It just had a list of frames that you could loop through or select.

For my 'cow' I needed to have multiple animation frames so I could select 'walk left' or 'walk right', 'nod head' etc. I also needed to reverse my animations to save creating duplicate cow frames just mirrored. 

WriteableBitmapEx to the rescue here and so now I have a dictionary of Animation frame lists that I can select and execute with the option to display mirrored.

Also added a Vehicle class which is just a static version of the above which doesn't need to move itself which can be used for a Bus or something.


For the 3rd time I've changed the way I'm positioning the guy on the ramp, the drag down thing never worked. I tried docking my guy to the foot of the ramp and when mouse dragged, I would restrict the movement based on the angle of the ramp. Almost! worked but again, move the mouse too fast and it all goes pear shaped. 

The pulley joint is the answer. Attached a pulley joint to the top of the ramp and one end to my chair and another to a block hanging over the other end of the ramp. With some buttons to control the ascent/descent I jut shorted or lengthen the rope and whats more, when I stop he just stays there without rolling back down. Works, almost, perfectly.


Stuck a set of buttons, up/down/Go on the top middle of the screen which are replaced once launched with lean forward, lean back and brake buttons that are used to affect the chair in flight and stop once landed.


Added a bunch of 'states'. Game state and player state. These are set used to determine where the guy is, jumping, landing, crashing and some game states such as initial(just starting and displaying splash screen), positioning (placing the guy on the ramp) and started (launched). Then these are used to show the appropriate controls and enable/disable certain buttons and also decide if the jump was succesfull or not and display 'next' or 'retry'.

Graphics and visuals

Now that the whole thing is working and I have levels and everything I can actually spend some time and effort sourceing some nice tilesets and graphics for my objects.

My approach to this project has been to get mechanics working and well thats it, get the mechanics working.

The coding and logic have been primary, everything else has just been 'put something in, ill fix it later'.


Well now its 'fix it later' time. If there is a benefit to this approach then its that as I'm replacing all my graphics its all suddenly starting to look like a real game, although next time I may change my approach and start getting the game mechanics in place as I go, a sort of Agile approach to gaming.

Mapping and tiling, a better approach

As Im about to map my 3rd level, I'm begining to find this whole tiling thing a bit tiresome. I've religiously stuck to my 64x64 px tileset and larger elements I've been slicing up using an online converter but theres a major flaw in my approach.

Well, 2 flaws. Firstly, the moon for example in my ET level is 24 images all need positioning in my map editor, ok, its no big deal but if i need to move it its slightly tiresome. Secondly, sky details such as clouds and stars and moons have their backgrounds as part of the tile which sucks. Meaning, a cloud on a blus sky wont go on a slightly darker sky or on a graduated sky.

In fairness, I probably dont need to do this but I've stuck with 3 levels of background layers, sky, middle ground and foreground, mainly because I just dont want the overhead of creating another massive bitmap to blit onto this layer. I've saved a bit of space by only generating bitmaps where I have images, so for example my forground layer has only ground objects and so only is about 4 or 5 tiles high, so my generated bitmap for the foreground is 4224x448px.

My sky however is 4224x2048px and having a 4th layer for sky details scares me for some reason but then I had a thought. Why dont I have 2 tile arrays but blit them over the top of each other on the same bitmap, so I can blit my sky and then write clouds into it. Simple and it works but then why even tile my sky, why not just stretch a single image over the entire background and then blit details to that.


I dont know why I didnt do this before. I've made a relatively simple change. I've created sky pngs which are just one screens worth in height and width (704x512) and are generally just a graduation which I stretch to fit then I tile my details over the top of it. Better still, Ive created some tiles which are not really tiles but objects in their entirity, like a 400x400px moon, with transparence so I can render them whereever I like. I knew my tile mapper would just handle this as where there is a zero (00) in the map I skip over not rendering anything which allows objects to overlap.


Anyway, all sounds straight forward but when I started out in the world of mapping levels the details got a bit lost.


More Levels and game dynamics

Not updated for a while but have been busy. I've mapped all my levels, 9 of them, 3 levels in each of 3 zones, desert, woodland and stadium. I wanted the last stage to be in a monster truck style arena just like the real thing.

Iv'e also finalised my scoring system. Just getting points for clearing a stage isn't variable enough so am awarding points based on the quality of the landing. I'm thinking a good landing will be with the wheels touching down nearer the top of the ramp than the bottom. As my ramps are made up of segments I can assign values to each segment and so 1000 pts if you land perfectly at the top and 200 if you just catch the bottom and a range in between. Points for stunts were also up for grabs and after toying with simply awarding 500 for each somersault I've decided to go with a multiplier, so each stunt multiplies the landing value to give you a score. So a landing on its own gives x points, 1 stunt give landing x2, 2 gives landing x3 etc.


I've also added some way of determining impact, I'm using velocity based impact which works here as my ramps and ground are static and my chair is hitting a static object and so with this I'm allowing the wheels to fly off on crashes over a certain impact. I've also added a hat or helmet to my drivers, just so It can fly off when they crash. All adds to the realism!


Finally, the ending. Rather than x levels and that's it, I'm adding a tenth level which will be a choice from 2, the burning hoop of death, where you have a steep ramp for height and you have to perfectly judge the jump to pass through a hoop safely and the shark infested, crocodile jump of death, a lower angled ramp set for distance where you have to land on a rubber dinghy on water.

After the 9th level you get to choose, complete that to be the hero. This also gives some replay value as to do the other final jump you have to replay the whole thing again.

Menus, options and awards

The thing I've pretty much left till last is all the intermediary screens like the 'menu', 'next level', 'game over' screens and to be honest, I've massively underestimated this. It's been all consuming, 6 weeks solid now and still some way off.


I needed banners saying 'well done' or 'try again', I need to show the scores between levels, player deaths, new players, help and more. Still, I'm well into this now and have pretty well all the visuals in for this now.

I've also decided on whether to have lives or be continuous retries a bit like Angry Birds. I've decided on lives, 3 of them, in fact 3 players in your team that you will cycle through, Geoff, Graham and Pete. I'm wondering if I may need more but I'm going with this right now. I'm aware that this might make the game actually quite difficult, if not impossible to complete, oh well.


One cool thing Iv's added, is a comic book style scrolling story. I can use this for the help, in that I will show the controls etc as a series of story boards, should be fun. I'm also using it to switch players, so as you fail a level with say Geoff, a mini comic pops up showing Geoff exit in an ambulance and Graham arrive. I will probably use it to show the well done on completion and maybe other things also. I'm liking this and looks, well, ok I think.