February 15, 2009

More Programming

Posted in gaming at 10:23 pm by Doug

Julian is going to fire me from the Ramparts game we are working on, but I did a side project this weekend as well as our game.

A Finished Battle

A Finished Battle

I made a Robot fighting game.  How it works – you make a file that has your robot’s commands and then it will fight other programmed robots until you lose 10 health.  I made it in C# using the microsoft XNA framework, so in order to play it you would need to have XNA installed on your computer.  If you would like the source code or the compiled game let me know and I’ll send it to you.  If you want your robots to fight against mine send me your instructions text file.

Your file has to be in this format each command has it’s own line and after your main commands you need an IF_HIT line followed by the commands if your robot gets shot, followed by IF_COLLIDE for what it should do if it collides with another robot.

all of the commands available are

MOVE # ( if number is 0 it will move to the opposite wall, else it will move that amount)

ROTATE # ( will rotate the robot that # of degrees)

ROTATE RANDOM (will rotate to a random degree)

SCAN (will scan for a robot)

FIRE (Fires your cannon in the current direction of the gun)

SET_ROBOT_TO_GUN (will turn your robot to match the current gun angle)

SET_GUN_TO_ROBOT (will turn your gun to match the current direction of your robot)

here is an example

ROTATE -90
MOVE 100
SCAN
FIRE
IF_HIT
MOVE 0
IF_COLLIDE
ROTATE 90
MOVE 100

Advertisement

1 Comment »

  1. Madrigorne said,

    its like the Turtle we used to program in Jr High – the kind with the pen.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.