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 Duhjoker » Wed Jul 27, 2016 9:05 am

Can't believe I made 8, 2 layer rooms tonight. But the good news is 12 rooms only cost me 10kb, prolly be 12 when I add the monsters. So with that I should be able to make 12 programs containing 12 rooms and thier player and monster sprites. Then maybe another three for the dungeons.
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 naed » Wed Jul 27, 2016 1:25 pm

That case looks pretty sweet that you made...

Have you managed to get your maps to display correctly yet?
User avatar
naed
 
Posts: 140
Joined: Tue May 31, 2016 3:18 pm

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Wed Jul 27, 2016 9:09 pm

Thanks!!!

No not yet gonna try to do a lil something today. Wanted to go ahead and make a good chunk of 12 rooms first.
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 28, 2016 3:05 am

ok that is an easier way to code and I understand most of it but the
Code: Select all

count =  gb.frame count
gb.display.printIn(count);



cant seem yo find it on the reference.

Heres the code I came up with, it just blinks back and forth. Also on the third

Code: Select all
 gb.display.setcolor (black);


is that for setting the background color which should be white?

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

const byte room_1_1[] PROGMEM = {88,48,
0xad,0xad,0xad,0xad,0xad,0xff,0xad,0xad,0xad,0xad,0xa0
,0x7f,0x7f,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0x7f,0x70
,0xf7,0xf7,0xf7,0xf7,0xf7,0xff,0xf7,0xf7,0xf7,0xf7,0xf0
,0x6e,0x6e,0x6e,0x6e,0x6e,0xff,0x6e,0x6e,0x6e,0x6e,0x60
,0x5d,0x5d,0x5d,0x5d,0x5d,0xff,0x5d,0x5d,0x5d,0x5d,0x50
,0xf7,0xf7,0xf7,0xf7,0xf7,0xff,0xf7,0xf7,0xf7,0xf7,0xf0
,0x7e,0x7e,0x7e,0x7e,0x7e,0xff,0x7e,0x7e,0x7e,0x7e,0x70
,0xb5,0xb5,0xb5,0xb5,0xb5,0xff,0xb5,0xb5,0xb5,0xb5,0xb0
,0xad,0xad,0xad,0xff,0xad,0xff,0xad,0xad,0xad,0xad,0xa0
,0x7f,0x7f,0x7f,0xff,0x7f,0xff,0x7f,0x7f,0x7f,0x7f,0x70
,0xf7,0xf7,0xf7,0xff,0xf7,0xff,0xf7,0xf7,0xf7,0xf7,0xf0
,0x6e,0x6e,0x6e,0xff,0x6e,0xff,0x6e,0x6e,0x6e,0x6e,0x60
,0x5d,0x5d,0x5d,0xff,0xff,0xff,0x5d,0x5d,0x5d,0x5d,0x50
,0xf7,0xf7,0xf7,0xff,0xff,0xff,0xf7,0xf7,0xf7,0xf7,0xf0
,0x7e,0x7e,0x7e,0xff,0xff,0xff,0x7e,0x7e,0x7e,0x7e,0x70
,0xb5,0xb5,0xb5,0xff,0xff,0xff,0xb5,0xb5,0xb5,0xb5,0xb0
,0xad,0xad,0xff,0xff,0xff,0xff,0xad,0xad,0xad,0xad,0xa0
,0x7f,0x7f,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0x7f,0x70
,0xf7,0xf7,0xff,0xff,0xff,0xff,0xf7,0xf7,0xf7,0xf7,0xf0
,0x6e,0x6e,0xff,0xff,0xff,0xff,0x6e,0x6e,0x6e,0x6e,0x60
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xad,0xad,0xff,0xff,0xff,0xff,0xff,0xff,0xad,0xad,0xa0
,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x70
,0xf7,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xf7,0xf0
,0x6e,0x6e,0xff,0xff,0xff,0xff,0xff,0xff,0x6e,0x6e,0x60
,0x5d,0x5d,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x5d,0x50
,0xf7,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xf7,0xf0
,0x7e,0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7e,0x7e,0x70
,0xb5,0xb5,0xff,0xff,0xff,0xff,0xff,0xff,0xb5,0xb5,0xb0
,0xad,0xad,0xff,0xff,0xff,0xff,0xff,0xff,0xad,0xad,0xa0
,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x70
,0xf7,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xf7,0xf0
,0x6e,0x6e,0xff,0xff,0xff,0xff,0xff,0xff,0x6e,0x6e,0x60
,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x50
,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf0
,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x70
,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb0,};

const byte room_1_2[] PROGMEM = {88,48,
0xdb,0xdb,0xdb,0xdb,0xdb,0xff,0xb6,0xdb,0xdb,0xdb,0xd0
,0xb6,0xb6,0xb6,0xb6,0xb6,0xff,0x6d,0xb6,0xb6,0xb6,0xb0
,0x6d,0x6d,0x6d,0x6d,0x6d,0xff,0xdb,0x6d,0x6d,0x6d,0x60
,0xdb,0xdb,0xdb,0xdb,0xdb,0xff,0xb7,0xdb,0xdb,0xdb,0xd0
,0xb7,0xb7,0xb7,0xb7,0xb7,0xff,0x6a,0xb7,0xb7,0xb7,0xb0
,0x6a,0x6a,0x6a,0x6a,0x6a,0xff,0xb5,0x6a,0x6a,0x6a,0x60
,0xb5,0xb5,0xb5,0xb5,0xb5,0xff,0xde,0xb5,0xb5,0xb5,0xb0
,0xde,0xde,0xde,0xde,0xde,0xff,0xdb,0xde,0xde,0xde,0xd0
,0xdb,0xdb,0xdb,0xff,0xdb,0xff,0xb6,0xdb,0xdb,0xff,0xd0
,0xb6,0xb6,0xb6,0xff,0xb6,0xff,0x6d,0xb6,0xb6,0xdb,0xb0
,0x6d,0x6d,0x6d,0xff,0x6d,0xff,0xdb,0x6d,0x6d,0xb6,0x60
,0xdb,0xdb,0xdb,0xff,0xdb,0xff,0xb7,0xdb,0xdb,0x6d,0xd0
,0xb7,0xb7,0xb7,0xff,0xff,0xff,0x6a,0xb7,0xb7,0xdb,0xb0
,0x6a,0x6a,0x6a,0xff,0xff,0xff,0xb5,0x6a,0x6a,0xb7,0x60
,0xb5,0xb5,0xb5,0xff,0xff,0xff,0xde,0xb5,0xb5,0x6a,0xb0
,0xde,0xde,0xde,0xff,0xff,0xff,0xdb,0xde,0xde,0xb5,0xd0
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xb6,0xdb,0xdb,0xda,0xd0
,0xb6,0xb6,0xff,0xff,0xff,0xff,0x6d,0xb6,0xb6,0xb6,0xb0
,0x6d,0x6d,0xff,0xff,0xff,0xff,0xdb,0x6d,0x6d,0x6d,0x60
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xb7,0xdb,0xdb,0xdb,0xd0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb,0xd0
,0xb6,0xb6,0xff,0xff,0xff,0xff,0xff,0xff,0xb6,0xb6,0xb0
,0x6d,0x6d,0xff,0xff,0xff,0xff,0xff,0xff,0x6d,0x6d,0x60
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb,0xd0
,0xb7,0xb7,0xff,0xff,0xff,0xff,0xff,0xff,0xb7,0xb7,0xb0
,0x6a,0x6a,0xff,0xff,0xff,0xff,0xff,0xff,0x6a,0x6a,0x60
,0xb5,0xb5,0xff,0xff,0xff,0xff,0xff,0xff,0xb5,0xb5,0xb0
,0xde,0xde,0xff,0xff,0xff,0xff,0xff,0xff,0xde,0xde,0xd0
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb,0xd0
,0xb6,0xb6,0xff,0xff,0xff,0xff,0xff,0xff,0xb6,0xb6,0xb0
,0x6d,0x6d,0xff,0xff,0xff,0xff,0xff,0xff,0x6d,0x6d,0x60
,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb,0xd0
,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb0
,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x60
,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb0
,0xde,0xde,0xde,0xde,0xde,0xde,0xde,0xde,0xde,0xde,0xd0,};
 

void setup(){
  gb.begin();
  gb.titleScreen(F("Myth of Esmerelda"));
   }


// the loop routine runs over and over again forever
void loop(){
    if(gb.update()){
    gb.display.setColor(BLACK);{
    gb.display.drawBitmap(0,0,room_1_1);     
    }

    gb.display.setColor(GRAY);{
    gb.display.drawBitmap(0,0,room_1_2);
    }

    gb.display.setColor(BLACK);
                                                               //declare a variable named count of type integer
    int count;
                                                               //get the number of frames rendered and assign it to the "count" variable
    count = gb.frameCount;
    //prints the variable "count"
    gb.display.println(count);
  }
}






Update edit: tried adding set frame rate, I used 10 but maybe I need different?
Last edited by Duhjoker on Thu Jul 28, 2016 8:01 am, 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 28, 2016 7:24 am

you said define variables for the player sprites? something like this.....

Code: Select all
typedef struct {
      int x;
      int y;
      int vx;
      int vy;
      int orientation;
     } Config;
      Config player;


and something like this
Code: Select all
if(gb.buttons.repeat(BTN_RIGHT,1)){ 
         player.x = player.x + player.vx;
         if(gb.buttons.repeat(BTN_A,1)){
         }else{
           player.orientation=1;
         }
      }
       
      if(gb.buttons.repeat(BTN_LEFT,1)){
        player.x = player.x - player.vx;
        if(gb.buttons.repeat(BTN_A,1)){
        }else{
           player.orientation=3;
         }
       }
       
       if(gb.buttons.repeat(BTN_DOWN,1)){
         player.y = player.y + player.vy;
         if(gb.buttons.repeat(BTN_A,1)){
        }else{
           player.orientation=2;
         }
       }
       
       if(gb.buttons.repeat(BTN_UP,1)){
         player.y = player.y - player.vy;
         if(gb.buttons.repeat(BTN_A,1)){
        }else{
           player.orientation=0;
         }
       }
       

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 28, 2016 7:57 pm

All right guys, is there a way to make the flashing look more solid?
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 naed » Thu Jul 28, 2016 8:21 pm

Are you trying this on your actual Gamebuino or on the emulator?
User avatar
naed
 
Posts: 140
Joined: Tue May 31, 2016 3:18 pm

Re: Newb at game making Sprite and game map developing

Postby Duhjoker » Thu Jul 28, 2016 9:04 pm

No ive been using the internet application. Yours looks ok but mine is crazy!!!
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 29, 2016 1:55 am

Well......... I was sitting at my computer looking at my Sprite maker screen and happened to look at the preview screen which at the time was sized to the Gamebuino screen. What I saw was that my lil 8x8 sprites I was using were still too big and couldn't really get accurate detail of the open ares with out fudging with it. I then recognized my lil characters were so small that they couldn't really benefit too much from the extra color.

My sever sprites actually look alright with out it. So now Using only 6x6 sprites allowed me to get pretty good details of rock terrain and bushes. Plus it's cheaper and I can still add all of the original elements to the game. 12 maps are 5.82KB.

Fortunately for me I was able to use most of my base color grey maps, all I had to do was add touch ups to the details which I did by copying and pasting.

Can I please get some critique on my player routine listed a couple posts back? I'm think I might be missing something but don't know what.

Thanks guys!!!!!!
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 29, 2016 6:04 am

ok this is what I was able to piece together out of what I can understand. Im having a problem with the
Code: Select all
if(gb.update()){
command in the void loop. It says gb was noy declared in this scope and icany figure out if its my code my syntax or missing brackets. ive tried several things but no go. I do know ive been looking at it for too long.

May I get some help on this please

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


                                                       /// room 1 in hexadecimal
const byte room_1[] = {88,48,
0xa6,0x9a,0x69,0xa6,0x9f,0xff,0xa6,0x9a,0x69,0xa6,0x90
,0x59,0x65,0x96,0x59,0x6f,0xff,0x59,0x65,0x96,0x59,0x60
,0xeb,0xae,0xba,0xeb,0xaf,0xff,0xeb,0xae,0xba,0xeb,0xa0
,0x5d,0x75,0xd7,0x5d,0x7f,0xff,0x5d,0x75,0xd7,0x5d,0x70
,0x79,0xe7,0x9e,0x79,0xef,0xff,0x79,0xe7,0x9e,0x79,0xe0
,0xa6,0x9a,0x69,0xa6,0x9f,0xff,0xa6,0x9a,0x69,0xa6,0x90
,0xa6,0x9a,0x7f,0xa7,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0x59,0x65,0xbf,0x5b,0xff,0xff,0xff,0xff,0xff,0x59,0x60
,0xeb,0xae,0xbf,0xeb,0xff,0xff,0xff,0xff,0xff,0xeb,0xa0
,0x5d,0x75,0xff,0x5f,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x79,0xe7,0xbf,0x7b,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa6,0x9a,0x7f,0xa7,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0x59,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x59,0x60
,0xeb,0xaf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xa0
,0x5d,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x79,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xa7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0x5b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x59,0x60
,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xa0
,0x5f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x7b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0x59,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x59,0x60
,0xeb,0xaf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xa0
,0x5d,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x79,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0x59,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x59,0x60
,0xeb,0xaf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xa0
,0x5d,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x79,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x90
,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60
,0xeb,0xae,0xba,0xeb,0xae,0xba,0xeb,0xae,0xba,0xeb,0xa0
,0x5d,0x75,0xd7,0x5d,0x75,0xd7,0x5d,0x75,0xd7,0x5d,0x70
,0x79,0xe7,0x9e,0x79,0xe7,0x9e,0x79,0xe7,0x9e,0x79,0xe0
,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x90,};



//sever sprites

const byte sever_rear[] PROGMEM = {6,6,1,1,1,1,1,1,0,1,1,1,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,};
const byte sever_right[] PROGMEM = {6,6,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,0,0,1,1,};
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,};
const byte sever_left[] PROGMEM = {6,6,0,1,1,1,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,};

#define NUM_SPRITES 4
const byte* Sprites_player[NUM_SPRITES] = {sever_rear, sever_right, sever_front, sever_left,};

///////player variables

typedef struct {
  int x;
  int y;
  int vx;
  int vy;
  int orientation;
}Config;
Config player;

const byte bullet[] PROGMEM = {2,2,1,1,1,1,};

float shootdelay;

typedef struct{
  boolean on;
  int x;
  int y;
  int vx;
  int vy;
  int orientation;
}
confshoot;



/////////GAME

void setup() {
  // put your setup code here, to run once:
  gb.begin()
  gb.titleScreen(F("Myth of Esmerelda"));
}

void initPlayer(){
  player.x=0;
  player.y=0;
  player.vx=0;
  player.vy=0;
  player.orientation=3;
}



void loop() {
  // put your main code here, to run repeatedly:
  if(gb.update()){
    gb.display.setColor(BLACK);
    gb.display.drawBitmap(0,0,room_1);
  }
   

   } 
      if(gb.buttons.repeat(BTN_RIGHT,1)){
        player.x = player.x + player.vx;
        if(gb.buttons.repeat(BTN_A,1)){
        }else{
          player.orientation=1;
        }
      }
     
      if(gb.buttons.repeat(BTN_LEFT,1)){
        player.x = player.x - player.vx;
        if(gb.buttons.repeat(BTN_A,1)){
        }else{
          player.orientation=3;
        }
      }
     
      if(gb.buttons.repeat(BTN_DOWN,1)){
        player.y = player.y + player.vy;
        if(gb.buttons.repeat(BTN_A,1)){
        }else{
          player.orientation=2;
        }
      }
     
      if(gb.buttons.repeat(BTN_UP,1)){
        player.y = player.y - player.vy;
        if(gb.buttons.repeat(BTN_A,1)){
        }else{
          player.orientation=0;
        }
      }
     
      if(gb.buttons.repeat(BTN_A,1)){
        if(shootdelay<=0){
            shootdelay=15-(player.rate*10/50);
            initShoot();
          }
      }





update::: I cleaned up the brackets but keep getting gb not declared and have no idea what to do.

Code: Select all
  Arduino: 1.6.7 (Windows 7), Board: "Arduino Duemilanove or Diecimila, ATmega328"

C:\Users\duhjoker\Desktop\Myth_of_Esmerelda\moe_learn\moe_learn.ino: In function 'void setup()':

moe_learn:99: error: 'gb' was not declared in this scope

    gb.begin();

    ^

C:\Users\duhjoker\Desktop\Myth_of_Esmerelda\moe_learn\moe_learn.ino: In function 'void loop()':

moe_learn:115: error: 'gb' was not declared in this scope

  { if(gb.update()){

       ^

moe_learn:122: error: 'gb' was not declared in this scope

       if(gb.buttons.repeat(BTN_RIGHT,1)){

          ^

moe_learn:130: error: 'gb' was not declared in this scope

       if(gb.buttons.repeat(BTN_LEFT,1)){

          ^

moe_learn:138: error: 'gb' was not declared in this scope

       if(gb.buttons.repeat(BTN_DOWN,1)){

          ^

moe_learn:146: error: 'gb' was not declared in this scope

       if(gb.buttons.repeat(BTN_UP,1)){

          ^

moe_learn:154: error: 'gb' was not declared in this scope

    if(gb.buttons.repeat(BTN_A,1)){

       ^

moe_learn:156: error: 'struct Config' has no member named 'rate'

             shootdelay=15-(player.rate*10/50);

                                   ^

moe_learn:157: error: 'initShoot' was not declared in this scope

             initShoot();

                       ^

exit status 1
'gb' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
     
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 21 guests