seperate sketches for seperate game aspects

Understanding the language, error messages, etc.

Re: seperate sketches for seperate game aspects

Postby Sorunome » Sat Aug 20, 2016 1:20 pm

Oooooh, i think you forgot `extern Gamebuino gb;` (in the other files, that is) so that you can use gb.<stuff> in the other files!
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: seperate sketches for seperate game aspects

Postby Duhjoker » Sat Aug 20, 2016 11:17 pm

Ok before I start driving myself nuts.......

Do I need the extern const byte sever_right[]; in the map.ino?

Do I need the extern const byte *spritesheet[]; in the player.ino?

Do I put both or one or the other in the Esmerelda.ino which has the void loop and setup?

Do I put the extern Gamebuino gb; in just the map.ino and the player.ino sketch?

Does the name of the loop matter for the player.ino and map.ino sketches?

My code is posted, have I got everything placed right in each sketch. Is something mixed up?

Please just take a look.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: seperate sketches for seperate game aspects

Postby Sorunome » Sun Aug 21, 2016 12:29 am

You basically need an "extern <whatever that variable definition was>" in the file in which you want to use said variable.

Skimming over your code it seems to me as if map.ino needs gb and player.ino needs gb, player_x, player_y, player_direction

I might have missed some, but yeah, you need an "extern <whatever the variable definition was>" in the file if that variable was actually decalred in a different file
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Previous

Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 16 guests

cron