smokin barrels by gamesheep

October 8th, 2008 by robotJAM

smokin_barrels.gif

I’m a big fan of western movies, especially the old Sergio Leone Dollars series and there aren’t many good western games. Smoking barrels however is one of the best, made by prolific games designers games sheep .

Firstly there’s a nice intro which explains how the main game mechanic works, its pretty clever, you place the mouse in a safe area and when the referee says shoot you have to throw your mouse at the target and shoot when it goes over. It feels almost exactly like a proper shoot out would, you get sweaty mouse finger waiting for the draw.

The game plays out over a number of tournaments each one getting slightly harder and you can spend winnings from each contest in the shop to buy better guns, or bullets or just dress up items for if you like that sort of thing.

As usual with everything Game Sheep do its amazingly well presented, lovely menus, and nice little animation touches.

The game is pretty much the perfect flash online game, it has a great core gameplay mechanic, lots of depths, progression through levels and a few nice mini games thrown in as well,

Go and play Smokin Barrels.

Tower Defence Tutorial : Route finding

August 23rd, 2008 by robotJAM

Ok so Tower Defence games are really popular so I thought I’d jump on the bandwagon and have a go at coding one from scratch, this is the journey from start to finish of the game.This will be a series  of tutorials separated into the main objects of the game, done in a reasonably logical manner.

Ok so the first thing to consider is how to get your creeps route finding.  They have to walk round a series of paths from one end of the map to the end. The easiest way I have found is to use a tweening engine. I use tweenfilterlite by greensock, you can download the class files here. The version I am using has slightly different syntax and is not the latest version.

The easiest way to create a map is to draw a path and then put down markers like the one below, I use a circle movieclip and duplicate it round the path, calling them marker1, marker2, marker3 etc.

td_background2.gif

As you can see there are 9 markers on the map. The creep will start at 1 and end at 9.

So lets create a creep(who is a panda). All the create function does is take 3 parameters startx, starty and speed.

var pCount:Number = 0;
 
function createPanda(startX, startY,speed) {
   pCount++;
 
   var nPandas = "pandas" + pCount;
   this.attachMovie("pandaClip", nPandas, this.getNextHighestDepth(),{_x:startX,_y:startY});
   this[nPandas].moves = 0;this[nPandas].speed = 50;this[nPandas].destX = this["marker"+this[nPandas].moves]._x;
   this[nPandas].destY = this["marker"+this[nPandas].moves]._y;
 
// start the panda moving
   newPandaMove(this[nPandas]);
}

Obviously this is just setting up where the panda will start,  and how fast it will move. The speed is not a real value of speed, just an abitary value. We also record which move the panda is on and where it is meant to walk to, that’s panda.move panada.destX and pandaDestY. The panda won’t do anything so we call newPandMove() to get him up and running.

function newPandaMove(whichPanda){
 
   whichPanda.moves++;
   whichPanda.destX = _root["marker"+whichPanda.moves]._x;
   whichPanda.destY = _root["marker"+whichPanda.moves]._y;
   var time = calcDistance(whichPanda,whichPanda.speed);
 
if (whichPanda.moves < 9){
   TweenFilterLite.to(whichPanda, time, {_x:whichPanda.destX, _y:whichPanda.destY, ease:None.easeNone, onComplete:newPandaMove, onCompleteParams:[whichPanda]});
 
}
else{whichPanda.gotoAndPlay("dead");}
 
}
 
function calcDistance(object,speed){
 
   var distY = object._y - object.destY;
   var distX = object._x - object.destX;
 
   var distance = Math.sqrt(distX*distX + distY*distY);
   var time = distance / speed;
 
   return(time);
}

So firstly newPandaMove() increments the panda’s move attribute, he is now on move 1 and we want him to move towards marker 1. So we set his destX and destY to the _x and _y of the marker he is aiming to. We first though need to calculate the distance he has to walk using calcDistance(). calcDistance() takes in the object and the objects speed and then works out using a bit of pythagoras thorem how long it will take to walk the path section, should probably bcalled calcTime.

That gets fed into  tweenfilterlite which says the panda should tween from where he is to the next marker over the time we have calculated. Then we use onComplete:newPandaMove, onCompleteParams:[whichPanda] to call the same function again when he has reached his destination.

We do a check to see if the marker he it at is the last one and if it is we tell the panda to gotoAndPlay(”dead”), which runs the last animation and deletes him from the stage.

var pandaInterval:Number = 200;
var frameCounter:Number = 0;
 
// MAIN GAME LOOP
 
onEnterFrame=function(){
 
frameCounter++;		
 
if (frameCounter % pandaInterval == 1){
      pandasOut++;
      createPanda(marker0._x,marker0._y,50);
      }
}

The last thing to do is the main game loop, we create 2 variables, a counter and a number for the interval between pandas, then we increment frameCounter each frame, and then test if frameCounter is a modulus of the interval, which means every 200 frames call createPanda and create a panda at the first marker with a speed of 50.

Hope that all makes sense, you can download the  sourcecode.

Next installment is creating a tower.

Astro Flyer

July 21st, 2008 by robotJAM

 astro_flyer.jpg

Astro Flyer is the first game (I think) from Game Reclaim and quite a good one it is too. It’s a fairly simple game where you have a spaceship and have to weave in 3d through various levels collecting as many stars as you can. Think “Star Fox” on the N64 but not as detailed and without foxes. You use the mouse to weave the ship from side to side and can boost with the mouse button, which is a nice idea.

The graphics are what set this game apart, the  3d effect is really quite slick, although its just scaling a series of movie clips with 3d projection it does really have a good 3d feel, its very similar to missile 3d from DX interactive which came out a while back. The graphics all have a cell shaded appearance which really hangs together nicely, in fact the overall presentation levels are excellent.

The only problem with Astro Flyer as a game as it is a little bit frustrating at times. It’s quite difficult to judge where your ship is in the 3d world. So I often find I’ve moved left and have hit an obstacle which I thought I’d flown past. Game Reclaim has a version on his own site which you can play in full screen, which I found made this less of a problem. I think this is a general problem though with these scaled 3d games, my own game cubex suffers from the same problem.

Anyway overall its a nice bit of technology turned into a slick looking game, which is generally quite fun to play.

Go play Astro Flyer.