Switch to full style
Understanding the language, error messages, etc.
Post a reply

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 8:21 am

It doesn't look like this will display a sprite to me

Code:
const byte sever_front[] PROGMEM = {6,6,1,1,1,1,1,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,};


The code for your sprite looks wrong

Should look like your code for the map (0xeb, 0xff...etc,) or there is another way to write a sprite (B00001001, B00100100... Etc)

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 8:32 am

Ok that makes since!!! Thank you I will try that now.

What about the colours? Do I need to invert maybe?

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 9:17 am

Its early moring here so ill catch back up in 8 or 9.

I did try inverting the colors and doing some other change ups after fixing my sever sprite (thank you again for the correction) but i still cant reverse the colors. So the background is neutral and the pixels i drew black.

The sever sprite still refuses to show up too.

I wonder if this has something to do with my encoder. Both the gamebuino and online converters would not pick up my black and neutral sprites. I had to redo them in gray before they would show up?

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 9:30 am

I also save them as png but i could open them up using win paint and save them that way whill give everything not pixeled white.

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 10:01 am

No worries, you didn't offend me at all, and I hope I didn't offend you either!

As you already found a gamebuino-specific tutorial, if that tutorial is good for you, then there isn't a need to have any more!

As to other tutorials, just through in "arduino tutorial" into your favourite search machine (such as google) and you'll get a ton of results.

Also, on the Getting Started page it does indeed mention the examples, in the Arduino IDE you click on File/Examples and there you have "Gamebuino"

Perhaps I'm not that good of a teacher for all the beginning, so please don't be offended by me and don't be discouraged to ask questions and learn!

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 7:30 pm

When i loaded up and ran your room you'd created I got a black floor and some walls... Is this not what you wanted? Did you want the floor to be white?

I'm unsure why you would want to invert the colors

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 8:39 pm

Yes sorry I would like the floor to be white. Here's a pic of how it should look.

Image

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 8:58 pm

I have no idea how you have encoded the map because it should display exactly how you have drawn it in that pic when encoded

Give me a few mins to get to a pc and I'll help you out

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 9:19 pm

Lol no problem!!!

Ok here's an update, I did some experimentation by opening the Piskell web page and drew some crap in the pixel field then exported it to my computer and then opened it up in paint and saved it which completely removes any transparency. I then opened it up on the the bitmap encoder and tried what it spit out and it gave me the correct image when I opened it in simbuino4web.

Re: Newb at game making Sprite and game map developing

Sat Jul 30, 2016 9:28 pm

Code:
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;

const byte map1[] PROGMEM = {88,48,
0x59,0x65,0x96,0x59,0x60,0x0,0x59,0x65,0x96,0x59,0x60,
0xA6,0x9A,0x69,0xA6,0x90,0x0,0xA6,0x9A,0x69,0xA6,0x90,
0x14,0x51,0x45,0x14,0x50,0x0,0x14,0x51,0x45,0x14,0x50,
0xA2,0x8A,0x28,0xA2,0x80,0x0,0xA2,0x8A,0x28,0xA2,0x80,
0x86,0x18,0x61,0x86,0x10,0x0,0x86,0x18,0x61,0x86,0x10,
0x59,0x65,0x96,0x59,0x60,0x0,0x59,0x65,0x96,0x59,0x60,
0x59,0x65,0x80,0x58,0x0,0x0,0x0,0x0,0x0,0x59,0x60,
0xA6,0x9A,0x40,0xA4,0x0,0x0,0x0,0x0,0x0,0xA6,0x90,
0x14,0x51,0x40,0x14,0x0,0x0,0x0,0x0,0x0,0x14,0x50,
0xA2,0x8A,0x0,0xA0,0x0,0x0,0x0,0x0,0x0,0xA2,0x80,
0x86,0x18,0x40,0x84,0x0,0x0,0x0,0x0,0x0,0x86,0x10,
0x59,0x65,0x80,0x58,0x0,0x0,0x0,0x0,0x0,0x59,0x60,
0x59,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x59,0x60,
0xA6,0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0x0,0x0,0x59,0x60,
0x59,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x59,0x60,
0xA6,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xA6,0x90,
0x14,0x50,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14,0x50,
0xA2,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xA2,0x80,
0x86,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x86,0x10,
0x59,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x59,0x60,
0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60,
0xA6,0x9A,0x69,0xA6,0x9A,0x69,0xA6,0x9A,0x69,0xA6,0x90,
0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x50,
0xA2,0x8A,0x28,0xA2,0x8A,0x28,0xA2,0x8A,0x28,0xA2,0x80,
0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x10,
0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60,
};

// the setup routine runs once when Gamebuino starts up
void setup(){
  // initialize the Gamebuino object
  gb.begin();
  //display the main menu:
  gb.titleScreen(F("Map test"));

}

// the loop routine runs over and over again forever
void loop(){
  //updates the gamebuino (the display, the sound, the auto backlight... everything)
  //returns true when it's time to render a new frame (20 times/second)
  if(gb.update()){
    //prints Hello World! on the screen
    gb.display.drawBitmap(0,0,map1);

  }
}


I rewrote your sprite for you and it displays how you want it to (the above displays your map)

what are you using to make your sprites, i simply fire up Paint and use that then encode it using the bitmap encoder


EDIT

thought i'd help you along a little bit, take a look at the following code this has a player sprite and basic movement / boundary detection, it may just give you a push in the right direction

Code:
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;

const byte map1[] PROGMEM = {88,48,
0x59,0x65,0x96,0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14,0x50,
0xA2,0x8A,0x28,0xA2,0x8A,0x28,0xA2,0x8A,0x28,0xA2,0x80,
0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x10,
0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60,
};

const byte player[] PROGMEM = {8,8,
  B00011100,
  B00011100,
  B00001000,
  B00011100,
  B00101010,
  B00001000,
  B00010100,
  B00100010,
};

  int player_x = 15;
  int player_y = 15;
 
// the setup routine runs once when Gamebuino starts up
void setup(){
  // initialize the Gamebuino object
  gb.begin();
  //display the main menu:
  gb.titleScreen(F("Map test"));


}

// the loop routine runs over and over again forever
void loop(){
  //updates the gamebuino (the display, the sound, the auto backlight... everything)
  //returns true when it's time to render a new frame (20 times/second)
  if(gb.update()){
    //prints Hello World! on the screen
    gb.display.drawBitmap(0,0,map1);

    gb.display.drawBitmap(player_x,player_y,player);


    if(gb.buttons.repeat(BTN_UP,1)){
      player_y = player_y - 1;}
    if(player_y <= 0){
      player_y = 0;}

    if(gb.buttons.repeat(BTN_DOWN,1)){
      player_y = player_y + 1;}
    if(player_y >= 40){
      player_y = 40;}

    if(gb.buttons.repeat(BTN_RIGHT,1)){
      player_x = player_x + 1;}
    if(player_x >= 77){
      player_x = 77;}

    if(gb.buttons.repeat(BTN_LEFT,1)){
      player_x = player_x - 1;}
    if(player_x <= -2){
      player_x = -2;}

  }
}
Post a reply