Switch to full style
Share your games and programs with the community.
Post a reply

UFO-Race

Wed Aug 06, 2014 4:28 pm

Description
A fast paced racing game where you have to finish a lap as fast as possible while avoiding obstacles.

Image

Controls
L/R Arrows: turn
A: Thrust
B: Brake
C: Exit

Download & source
Download .zip containing source, hex, elf
GitHub repository

Features
Easily create your own map by editing world.ino
Fast and smooth driving
Smooth camera which looks in the direction you're going depending on your speed
Minimap
Accepts large maps (the provided maps is 32*32, 128*64 tiles should fit)
Different obstacles: ice, sand, etc.
5 best scores saved in EEPROM along with their name

To do
More maps
Read maps from SD card
Map editor
Multiplayer

Re: UFO-Race

Wed Aug 06, 2014 4:36 pm

That is super! Oh my! mini map and all! :D

Re: UFO-Race

Wed Aug 06, 2014 4:58 pm

Just spotted this while having a look through your GitHub, very cool, can't wait to play it and see how you've coded it!

Re: UFO-Race

Wed Aug 06, 2014 5:57 pm

Very fun. Thanks!

and I like that I can use it for examples with movement speed.. terrain effecting speed and map making!

Re: UFO-Race

Wed Aug 06, 2014 6:06 pm

treflip wrote:and I like that I can use it for examples with movement speed.. terrain effecting speed and map making!

Yeah that was initially intended as an example an ended up being a games few hours later :lol:

Re: UFO-Race

Wed Aug 06, 2014 7:48 pm

Oh, Nice! (Now the first song from F-zero is stuck in my head, and I haven't even tried loading this game up yet)

Re: UFO-Race

Thu Aug 07, 2014 4:36 am

trying to make a map (harder that I thought) and I got a record of 628 on the deafault map. later today, I played again and the crabator high acore data showed up. any idea of why?

Re: UFO-Race

Thu Aug 07, 2014 9:23 am

My record is 608 ;)

If Crabator is on your Gamebuino and you upload UFO-Game via USB, the loader don't know that the game changed, and the EEPROM isn't erased (so it still contains Crabator's high scores). You should always get back to the loader by pressing 'C' in the main menu to backup you EEPROM and avoiding messing up you saved games.

What didn't you understand in making your own map? You only have to change the values in the array "world". Each "0x" is followed by 2 characters each representing one tile. For example 0xDC represents a "block_up" and a "block_left". If you change the size of the world don't forget to change WORLD_W and WORLD_H accordingly.

Code:
#define WORLD_W 32
#define WORLD_H 32
const byte world[WORLD_W*WORLD_H/2] PROGMEM = {
  0xDC,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xAD,
  0xF0,0x01,0x71,0x00,0x00,0x00,0x00,0xD0,0x00,0x00,0x0D,0xD0,0x00,0x00,0x05,0x5F,
  0xF0,0x0C,0xEE,0xEE,0xEE,0xEA,0x00,0xF0,0x0D,0x00,0x0F,0xF0,0x00,0x00,0x00,0x5F,
  0xF0,0x00,0xD5,0x55,0x00,0x5D,0x00,0xF0,0x0F,0xD0,0x0F,0xF0,0x0D,0x50,0x00,0x0F,
  0xF0,0x80,0xF5,0x00,0x00,0x0F,0x00,0xF0,0x0F,0xF0,0x0F,0xF0,0x0F,0xCA,0x80,0x0F,
  0xF0,0x00,0xF0,0x00,0xD0,0x0B,0x00,0xF0,0x4F,0xF0,0x0F,0xF0,0x0F,0x55,0x00,0x0F,
  0xF0,0x80,0xF0,0xD0,0xF5,0x00,0x05,0xF4,0x4F,0xF0,0x0B,0xB0,0x0F,0x50,0x00,0x5F,
  0xF0,0x00,0xF0,0xB0,0xF5,0x55,0x55,0xF4,0x6F,0xF0,0x00,0x00,0x0F,0x00,0x00,0x5F,
  0xF0,0x80,0xF0,0x00,0xBC,0xEE,0xEA,0xB6,0x6F,0xF0,0x00,0x00,0x0F,0x00,0x8C,0xAF,
  0xF0,0x00,0xF5,0x00,0x00,0x00,0x66,0x66,0x6F,0xBC,0xEE,0xEE,0xAF,0x50,0x00,0x5F,
  0xF0,0x40,0xB5,0x55,0x00,0x06,0x66,0x66,0x6F,0x00,0x00,0x00,0x0B,0x55,0x00,0x0F,
  0xF5,0x00,0x0C,0xEE,0xEE,0xEE,0xEE,0xEE,0xAB,0x00,0x00,0x00,0xCE,0xEA,0x00,0x0F,
  0xF5,0x50,0x00,0xCE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEA,0x00,0x5F,
  0xF5,0x55,0x00,0x00,0x00,0x00,0x55,0xCE,0xEA,0x55,0x08,0x88,0x88,0x00,0x00,0x5F,
  0xF5,0x55,0x50,0x00,0x00,0x00,0x00,0x03,0x30,0x00,0x00,0x00,0x00,0x00,0x05,0x5F,
  0xBC,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xA8,0x88,0x88,0xCE,0xEE,0xAB,
};


To know which value correspond to which tile you can see it just above the variable "world" :

Code:
// array containing the different sprites
#define NUM_SPRITES 16
const byte* sprites[NUM_SPRITES] = {
  road,              //0
  power_right,       //1
  power_down,        //2
  power_left,        //3
  power_up,          //4
  sand,              //5
  ice,               //6
  start,             //7
  block_bouncer,     //8
  block_single,      //9
  block_right,       //A
  block_down,        //B
  block_left,        //C
  block_up,          //D
  block_horizontal,  //E
  block_vertical     //F
};

Re: UFO-Race

Thu Aug 07, 2014 9:38 pm

I was wondering how the level was encoded, that's pretty neat. Is the ability to save the highscore list a part of the stock library I'm assuming so.

Re: UFO-Race

Thu Aug 07, 2014 10:45 pm

Nope, the highscore saving to EEPROM is not part of the library. It's all in the file highscore.ino so you can copy/past it to your own game. Although mind that here the highest score is the lowest value here, so you might have to reverse it for your game.
The fact the the EEPROM (containing the high scores) is saved and backed up from the micro SD card when you switch between games is part of the loader.
Post a reply