[WIP] " PADIRAC " a Lander clone

Advice on general approaches or feasibility and discussions about game design

[WIP] " PADIRAC " a Lander clone

Postby luc » Thu Jun 18, 2015 1:26 am

Hi, as a first project I'm trying to make a simple Lander game. I have no experience with C/C++ only a bit of C# in Unity and AS3Flash.
English is not my first language so feel free to bluntly correct me.
The name comes from a chasm you can visit near my hometown. http://www.gouffre-de-padirac.com/
It will have 6/7 different sceneries, starting from the plains and then going through mountains,cave entrance and finally the chasm itself.

Image

I've got the ship movement working. Now animated sprites and tilemaps are my new nightmare.
Still tinkering with Flappy Birdo source by Jerom but I don't fully understand the way images are animated :(

Also I'm wondering how to enable auto completion with Sublime text ?
Last edited by luc on Thu Jun 18, 2015 2:29 pm, edited 1 time in total.
luc
 
Posts: 3
Joined: Tue Jun 02, 2015 6:31 am

Re: " PADIRAC " a Lander clone

Postby rodot » Thu Jun 18, 2015 10:02 am

Hey, and welcome among us :)

Your game looks great, I hope you'll manage to make it work... to help I made you a quick example about animated sprites :

Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;

#define NUM_FRAME_SMALL 5
const byte smallEnemyBitmap[NUM_FRAME_SMALL][10] PROGMEM = {
  { 8, 8, 0x0, 0x7E, 0x6C, 0x6C, 0x7E, 0x7E, 0x7E, 0x66,},
  { 8, 8, 0x7E, 0x6C, 0x6C, 0x7E, 0x7E, 0x3C, 0x3C, 0xC,},
  { 8, 8, 0x7E, 0x6C, 0x6C, 0x7E, 0x7E, 0x38, 0x38, 0x18,},
  { 8, 8, 0x7E, 0x6C, 0x6C, 0x7E, 0x7E, 0x1C, 0x1C, 0x18,},
  { 8, 8, 0x0, 0x7E, 0x6C, 0x6C, 0x7E, 0x7E, 0x3C, 0x30,}
};

#define NUM_FRAME_BIG 6
const byte bigEnemyBitmap[NUM_FRAME_BIG][22] PROGMEM = {
  { 16, 10, 0x0, 0x0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x38, 0xE0, 0x38, 0xE0,},
  { 16, 10, 0x0, 0x0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x1, 0xC0,},
  { 16, 10, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0xF, 0x0, 0x7, 0x0,},
  { 16, 10, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x7, 0x80, 0x7, 0x0,},
  { 16, 10, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0xF, 0x80, 0xE, 0x0,},
  { 16, 10, 0x3F, 0xE0, 0x3F, 0xE0, 0x3D, 0xA0, 0x3D, 0xA0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x3F, 0xE0, 0x1D, 0xC0, 0x1C, 0x0,}
};

void setup(){
  gb.begin();
  gb.titleScreen(F("Animated Sprite"));
}

void loop(){
  if(gb.update()){
     byte frame = gb.frameCount % NUM_FRAME_SMALL;
     gb.display.drawBitmap(10, 40, smallEnemyBitmap[frame]);
     frame = (gb.frameCount/2) % NUM_FRAME_SMALL;
     gb.display.drawBitmap(20, 40, smallEnemyBitmap[frame], NOROT, FLIPH);
     frame = gb.frameCount % NUM_FRAME_BIG;
     gb.display.drawBitmap(30, 38, bigEnemyBitmap[frame]);
  }
}


In short you make an array of bitmaps, and access the frame you want each time. In the example, it's based on gb.frameCount so it runs at a constant speed. When I want to animate walking characters, I base the frame to play on the X coordinate of the character, so the faster it moves along the X axis, the faster it's animated (as in Super Crate Buino).

Edit : for dynamic tilemaps, you can refer to the TileMapRAM example. If your tilemap won't change after compilation, it's better to store it into the progmem rather than RAM (as RAM is pretty scarce), like I did in [urlhttp://gamebuino.com/forum/viewtopic.php?f=17&t=972]UFO Race[/url].

PS: I've been to the Gouffre de Padirac once when I was young (well I'm still young but you get my point) :)
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: " PADIRAC " a Lander clone

Postby luc » Thu Jun 18, 2015 2:16 pm

Wow thanks a lot Aurélien !!!!
Works like a charm. Can't wait to make particles, animated scenery and whatever fits in :)

Image

Tilemaps will be static thanks for the link (again!).
Now I can't see why I couldn't finish the game. So happy !
luc
 
Posts: 3
Joined: Tue Jun 02, 2015 6:31 am

Re: [WIP] " PADIRAC " a Lander clone

Postby erico » Thu Jun 18, 2015 2:37 pm

Congrats, its movement is fantastic.
Also very well animated and I love the ship´s design, it is quite an anusual one.
Maybe add a landing/take off animation?

Keep it up. :)
User avatar
erico
 
Posts: 671
Joined: Thu Mar 27, 2014 9:29 pm
Location: Brazil

Re: [WIP] " PADIRAC " a Lander clone

Postby luc » Sun Jun 21, 2015 6:32 pm

Thanks Erico !

I've redesigned the ship, it was too big and didn't leave much space for designing the level.
Also put some basic frames for the ship states animations.(landed, falling, right/left thrust, down thrust)
I don't think I will make complex animations since it gets blurred on the Gamebuino screen.

Image

Regarding the map, could I use a .csv file with a basic wrapper ?
Godot did you make your map in a map editor ?
luc
 
Posts: 3
Joined: Tue Jun 02, 2015 6:31 am

Re: [WIP] " PADIRAC " a Lander clone

Postby erico » Sun Jun 21, 2015 7:31 pm

That is super great Luc.

I see what you mean by ´size of ship´. We have some discussion on a thread me and Myndale are working on a lunar lander clone, it might be a good read/inspiration, check it out:
viewtopic.php?f=13&t=1075&hilit=lunar+run

It might interest you Myndale´s code to load levels from the sd card and collision detection stuff.
Cheers!
User avatar
erico
 
Posts: 671
Joined: Thu Mar 27, 2014 9:29 pm
Location: Brazil


Return to Project Guidance & Game development

Who is online

Users browsing this forum: No registered users and 88 guests

cron