Hello again
I’m back with some good news. Now I can move the hunter and the bird(it looks so realistic ) flies through the screen but it doesn’t turn back and it doesn’t have a flying animation right now. So I think I’m going to continue the programming(shooting, menu, animations, maybe highscores?) on next Friday or the next saturday because I’m a student so I have a lot of stuff to learn(). And here’s the code:
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
//Változó deklaráció
int playerPos = 0;
int birdPosX = 70;
int birdPosY = 10;
int birddead = 0;
const byte Huntersprite[][32] PROGMEM =
{
15,15,
B00000000,B00000100,
B00000000,B00001000,
B00111010,B00010000,
B01000100,B01100000,
B00110101,B10000000,
B01100110,B00000000,
B00100100,B01000000,
B00011000,B11000000,
B00101101,B10000000,
B00111111,B00000000,
B01000010,B00000000,
B01000010,B00000000,
B01000010,B00000000,
B10000001,B00000000,
B10000001,B00000000,
};
const byte Huntersprite2[][20] PROGMEM =
{
8,18,
B00010000,
B00010000,
B00010000,
B00010000,
B00011000,
B00100100,
B01011010,
B01100110,
B01011110,
B00100100,
B00111100,
B01000010,
B01000010,
B10000001,
B10000001,
B10000001,
};
const byte Huntersprite3[][32] PROGMEM =
{
15,15,
B00100000,B00000000,
B00010000,B00000000,
B00001000,B01011100,
B00000110,B00110010,
B00000001,B10101100,
B00000000,B01100110,
B00000000,B00100100,
B00000010,B00011000,
B00000011,B00110100,
B00000001,B11111100,
B00000000,B01000010,
B00000000,B01000010,
B00000000,B01000010,
B00000000,B10000001,
B00000000,B10000001,
};
const byte bullet[][4] PROGMEM =
{
8,2,
B10000000,
B10000000,
};
const byte Pigeonsprite1[][12] PROGMEM =
{
14,5,
B11111000,B00000000,
B00000100,B00000000,
B00000101,B11111000,
B00000010,B00000100,
B00000100,B00000100,
};
const byte Pigeonsprite2[][12] PROGMEM =
{
14,5,
B00000000,B00000000,
B01111100,B01111000,
B10000010,B10000100,
B10000001,B00000100,
B00000000,B00000100,
};
const byte Pigeonsprite3[][12] PROGMEM =
{
14,5,
B00000000,B01111100,
B00000000,B10000000,
B01111110,B10000000,
B10000001,B00000000,
B10000000,B10000000,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F(“Pigeon Season”));
};
// the main loop
void loop(){
if(gb.update()){
//gb.display.drawBitmap(10,10,sprite[0]);
if (gb.buttons.pressed(BTN_LEFT)) {
if (playerPos > -2) {
playerPos–;
}
}
if (gb.buttons.pressed(BTN_RIGHT)) {
if (playerPos < 2) {
playerPos++;
}
}
if (playerPos == 0) {
gb.display.drawBitmap(38,30,Huntersprite2[0]);
}
if (playerPos == -1) {
gb.display.drawBitmap(19,30,Huntersprite[0]);
}
if (playerPos == 1) {
gb.display.drawBitmap(64,30,Huntersprite3[0]);
}
if (birddead == 0) {
gb.display.drawBitmap(birdPosX–,birdPosY,Pigeonsprite1[0]);
/*if (birdPosX <= 14) {
gb.display.drawBitmap(birdPosX++,birdPosY,Pigeonsprite1[0]);
}
if (birdPosX >= 70) {
gb.display.drawBitmap(birdPosX–,birdPosY,Pigeonsprite1[0]);
};
*/}
}
};