Sun Nov 02, 2014 12:23 am
Sun Nov 02, 2014 12:31 am
player.ino: In function 'void loop()':
player.ino:1:6: error: redefinition of 'void loop()'
SlasherBroken.ino:28:6: error: 'void loop()' previously defined here
player.ino:3:16: warning: statement has no effect [-Wunused-value]
player.ino:6:16: warning: statement has no effect [-Wunused-value]
player.ino:9:16: warning: statement has no effect [-Wunused-value]
player.ino:12:16: warning: statement has no effect [-Wunused-value]
Sun Nov 02, 2014 4:54 am
if (gb.buttons.pressed(BTN_UP)){
playery - 5;
}
playery = playery - 5;
// **OR***
playery -= 5;
Mon Nov 03, 2014 12:11 am
Mon Nov 03, 2014 9:15 pm
Skyrunner65 wrote:So what should I do? I've tried naming "void loop" to "void buttons", and that doesn't work.
Skyrunner65 wrote: so should I put the second void loop() under the first
void buttons()
{
// your player movement can go here
}
void setup()
{
// all the gb stuff
}
void loop()
{
buttons();
// some more stuff
}
Mon Nov 03, 2014 11:57 pm
Tue Nov 04, 2014 7:39 am
#define PLAYERMOVEMENT 5
int playerx = 0;
int playery = 0;
void play() {
if (gb.buttons.pressed(BTN_DOWN)){
playery += PLAYERMOVEMENT; // Pre-processor will replace PLAYERMOVEMENT with the value 5
};
if (gb.buttons.pressed(BTN_LEFT)){
playerx -= PLAYERMOVEMENT; // Now I will automatically have the same value here, thanks to the #define
};
}
Tue Nov 04, 2014 7:09 pm
Tue Nov 04, 2014 8:13 pm
SlasherBroken.ino:4:15: error: expected initializer before numeric constant
SlasherBroken.ino:34:15: error: expected initializer before numeric constant
Wed Nov 05, 2014 12:02 am
void setup(){
gb.begin();
gb.display.setFont(font5x7);
gb.titleScreen(F(" Slasher"), logo);
gb.battery.show = false;
gb.sound.setVolume(100)
}