Hi everybody
Iām back with my very first MAKERbuino game. Itās not finished of course because I started programming yesterday. Yeah, from itās name you can know that this game will be a Duck Hunt like game with some mixed elements from my fatherās first quartz handheld console. It will feature a highscore list(maybe), a very realistic bird and hunter( ) and some another things like new kinds of bullets(Grenade, fast, bird-slower, etc.). So at the end 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]);
};
*/}
}
};
Iām a little bit confused about the shooting mechanics. Could you help me about it?
Thanks,
Beni0121
(sorry if my spelling is bad, but Iām a hungarian student )