Newb at game making Sprite and game map developing

Understanding the language, error messages, etc.

Re: Newb at game making Sprite and game map developing

Postby Sorunome » Thu Jul 07, 2016 7:06 am

As I already said in my previous post, you will need to write your own tilemapping routine
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Thu Jul 07, 2016 9:21 am

Ok i searcged for tile map routine on the forum and on google and the only hit i got was for the tile map editor.

Can you give me a better clue of what to look for? Please?
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: Newb at game making Sprite and game map developing

Postby Sorunome » Thu Jul 07, 2016 10:10 am

You could try to come up with your own routine to iterate over the tilemap data and draw the tiles, it should help you to learn more about programming. (for an experienced programmer this is a simple task)

The basic idea is to have two nested for-loops going over the x and y-coordinates and draw the sprites at the correct place.

EDIT: it also helps you to learn about how pointers are working
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: Newb at game making Sprite and game map developing

Postby rodot » Thu Jul 07, 2016 2:12 pm

Here is a simple example showing how a render a tile map : TileMapRAM
For a simple game running a PROGMEM tile map you can look at UFO Race, especially the file world.ino.
Hope that helps!
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Thu Jul 07, 2016 8:58 pm

edited no relevant information
Last edited by Duhjoker on Tue Aug 02, 2016 11:29 pm, edited 1 time in total.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Thu Jul 07, 2016 10:54 pm

Just looked at your game example. Actually i was thinking more "descent into hell". Its a room by room type game like Zelda but all dungeon.

I need the room to not move but the chatacter moving around with in, then stepping through a door way to another room and etc.

I just dont know which file to look at to see how the room was built.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Fri Jul 08, 2016 12:58 am

ok looking at the arduino example, looking at the first set of code........

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

//store the different sprites in PROGMEM to save RAM
const byte grass[] PROGMEM = {16, 16, 0x10,0x0,0x28,0x2,0x10,0x0,0x0,0x0,0x0,0x0,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x8,0x4,0x0,0x0,0x0,};
const byte rocks[] PROGMEM = {16, 16, 0x20,0x0,0x50,0x0,0x21,0xe1,0x6,0x18,0x8,0xc,0x8,0x4,0x3c,0x6,0x42,0x7,0x40,0x37,0x40,0x1f,0x23,0x9e,0x1c,0x7e,0x8,0x3c,0x8,0x78,0x7,0xe0,0x0,0x0,};
const byte road_straight[] PROGMEM = {16, 16, 0x1f,0xf8,0x1f,0xf8,0x5e,0x78,0x1e,0x78,0x1e,0x78,0x1e,0x78,0x1e,0x79,0x1e,0x78,0x1f,0xf8,0x1f,0xf8,0x1e,0x78,0x1e,0x78,0x9e,0x78,0x1e,0x78,0x1e,0x78,0x1e,0x78,};
const byte road_turn[] PROGMEM = {16, 16, 0x1f,0xf8,0x1f,0xf8,0x1f,0xfc,0x1f,0xff,0x1f,0xff,0xf,0xff,0xf,0xff,0x7,0xff,0x87,0xff,0x3,0xff,0x1,0xff,0x0,0x7f,0x2,0x1f,0x0,0x0,0x0,0x0,0x40 ,0x0,};

// array containing the different sprites
#define NUM_SPRITES 4
const byte* sprites[NUM_SPRITES] = {
  grass, rocks, road_straight, road_turn};



I see that this is naming the sprites, giving the size of the sprite and then the sprite graphic in hexa-decimal(?)?

do I have to break my sprite into the 0x00 type code or can I just point it to the sprites in my folder?

if I have to use the 0x00 format, how exactly do I render my spites in that format?
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Fri Jul 08, 2016 9:25 am

Wait...... Do i need to make a sprite sheet first before i start working my tile map?

Still dont understand about the sprites in the example being in 0x00 format though. Cant seem to find anything but i may not be looking up the right term.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: Newb at game making Sprite and game map developing

Postby Sorunome » Fri Jul 08, 2016 9:32 am

The 0x00 format is just a format to write numbers, the 0x prefix tells you that the following number is hexadecimal. That is useful as two digets is then one byte and thus you can easily grasp the data without taking up too much space to write.

You will have to convert your sprites with one of your tools to binary/hexadecimal/whatever to include them in your ino to be able to draw them.

Have you already successfully drawn sprites? Perhaps you should start there before doing tilemaps.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Fri Jul 08, 2016 7:54 pm

I have at least twenty sprites that i made using an online sprite maker but it saves them to .png or you can save at as a base 64?

What tools are out there to turn my sprites to the Hex format. I looked all day yesterday and couldnt find anything.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

PreviousNext

Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 23 guests