Sat Jan 24, 2015 11:01 pm
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("jasons HEX thingy"));
gb.titleScreen(F("press A to start"));
}
// the loop routine runs over and over again forever
void loop(){
//first screen
while(true){
if(gb.update()){
//prints Hello World! on the screen
gb.display.println(F("Hello World!"));
//me stuffz
gb.display.println("Jason Harriot 2015");
if(gb.buttons.pressed(BTN_A)){
break; //break out of the while loop when A is pressed
}
}
}
//second screen
int num = 0;
int offsetpause = 0;
while(true){
if(gb.update()){
if(gb.buttons.pressed(BTN_A)){
if(offsetpause = 1){
offsetpause = 0;
}
else{
if(offsetpause = 0){
offsetpause = 1;
}
if(offsetpause = 1){
num += 1;
}
gb.display.println(num);
if(gb.buttons.pressed(BTN_B)){
num = 0;
gb.popup(F("reset"), 10);
}
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("super dumb app"));
}
}
}
Sun Jan 25, 2015 12:25 am
if (offsetpause == 1) {
if (offsetpause = 1) {
else{
if(offsetpause = 0){
offsetpause = 1;
}
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
int state;
int num;
int offsetpause;
// the setup routine runs once when Gamebuino starts up
void setup() {
restart_game();
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("jasons HEX thingy"));
gb.titleScreen(F("press A to start"));
}
void restart_game() {
state = 0;
num = 0;
offsetpause = 0;
}
// the loop routine runs over and over again forever
void loop() {
if (gb.update()) {
//first screen
if (state == 0) {
//prints Hello World! on the screen
gb.display.println(F("Hello World!"));
//me stuffz
gb.display.println("Jason Harriot 2015");
if (gb.buttons.pressed(BTN_A)){
state = 1;
}
}
//second screen
if (state == 1) {
if (gb.buttons.pressed(BTN_A)) {
if (offsetpause == 1) {
offsetpause = 0;
num += 1;
} else if (offsetpause == 0) {
offsetpause = 1;
}
}
gb.display.println(num);
if (gb.buttons.pressed(BTN_B)) {
num = 0;
gb.popup(F("reset"), 10);
}
}
if (gb.buttons.pressed(BTN_C)) {
// Go back to the title screen if C is pressed in the 2nd screen
restart_game(); // Be sure to reset the game variables
gb.titleScreen(F("super dumb app"));
}
}
}
Sun Jan 25, 2015 2:49 pm
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
static unsigned char PROGMEM logo[]=
{
45,10,
B0000000000000000000000000000000000000000000000,
B0111111001111000111110011110011001100001100110,
B0111111011111101111110111111011001100001100110,
B0001100011001101100000110011011101100001100110,
B0001100011111101111100110011011111100001100110,
B0001100011111100111110110011011111100001111110,
B0101100011001100000110110011011011100001111110,
B0111100011001101111110111111011001101101100110,
B0111100011001101111100011110011001101101100110,
B0000000000000000000000000000000000000000000000,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("Work in progress"), logo);
}
// the loop routine runs over and over again forever
void loop(){
//second screen
int num = 0;
int dat = 0;
while(true){
if(gb.update()){
gb.battery.show = false;
if(gb.buttons.pressed(BTN_A)){
dat = 1;
}
if(gb.buttons.pressed(BTN_B)){
dat = 0;
}
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
if(dat == 1){
num += 1;
}
gb.display.println(num);
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("Work in progress"), logo);
}
Sun Jan 25, 2015 3:50 pm
Sun Jan 25, 2015 3:59 pm
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
static unsigned char PROGMEM logo[]=
{
46,10,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B01111110, B01111000, B11111001, B11100110, B01100001, B10011000,
B01111110, B11111101, B11111011, B11110110, B01100001, B10011000,
B00011000, B11001101, B10000011, B00110111, B01100001, B10011000,
B00011000, B11111101, B11110011, B00110111, B11100001, B10011000,
B00011000, B11111100, B11111011, B00110111, B11100001, B11111000,
B11011000, B11001100, B00011011, B00110110, B11100001, B11111000,
B11111000, B11001101, B11111011, B11110110, B01101101, B10011000,
B11111000, B11001101, B11110001, B11100110, B01101101, B10011000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
};
static unsigned char PROGMEM bug[]=
{
8,8,
B00000000,
B00100100,
B00011000,
B01111110,
B00111100,
B01111110,
B00111100,
B00000000,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("Work in progress"), logo);
}
// the loop routine runs over and over again forever
void loop(){
//second screen
int num = 0;
int dat = 0;
while(true){
if(gb.update()){
gb.battery.show = false;
if(gb.buttons.pressed(BTN_A)){
dat = 1;
}
if(gb.buttons.pressed(BTN_B)){
dat = 0;
}
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
if(dat == 1){
num += 1;
}
gb.display.println(num);
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("Work in progress"), logo);
}
Sun Jan 25, 2015 4:08 pm
Sun Jan 25, 2015 9:26 pm
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
int bug_x = LCDWIDTH/2; //set the horizontal position to the middle of the screen
int bug_y = LCDHEIGHT/2; //vertical position
int bug_vx = 1; //horizontal velocity
int bug_vy = 1; //vertical velocity
int bug_size = 8; //the size of the ball in number of pixels
static unsigned char PROGMEM logo[]=
{
46,10,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B01111110, B01111000, B11111001, B11100110, B01100001, B10011000,
B01111110, B11111101, B11111011, B11110110, B01100001, B10011000,
B00011000, B11001101, B10000011, B00110111, B01100001, B10011000,
B00011000, B11111101, B11110011, B00110111, B11100001, B10011000,
B00011000, B11111100, B11111011, B00110111, B11100001, B11111000,
B11011000, B11001100, B00011011, B00110110, B11100001, B11111000,
B11111000, B11001101, B11111011, B11110110, B01101101, B10011000,
B11111000, B11001101, B11110001, B11100110, B01101101, B10011000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
};
static unsigned char PROGMEM bug[]=
{
8,8,
B00000000,
B00100100,
B00011000,
B01111110,
B00111100,
B01111110,
B00111100,
B00000000,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("Work in progress"), logo);
}
// the loop routine runs over and over again forever
void loop(){
gb.battery.show = false;
//move the bug using the buttons
if(gb.buttons.repeat(BTN_RIGHT,2)){ //every 2 frames when the right button is held down
bug_x = bug_x + bug_vx; //increase the horizontal position by the bug's velocity
gb.sound.playTick(); //play a preset "tick" sound every time the button is pressed
}
if(gb.buttons.repeat(BTN_LEFT,2)){
bug_x = bug_x - bug_vx;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_DOWN,2)){
bug_y = bug_y + bug_vy;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_UP,2)){
bug_y = bug_y - bug_vy;
gb.sound.playTick();
}
//bonus : play a preset sound when A and B are pressed
if(gb.buttons.pressed(BTN_A)){
gb.sound.playOK();
}
if(gb.buttons.pressed(BTN_B)){
gb.sound.playCancel();
}
//check that the bug is not going out of the screen
//if the bug is touching the left side of the screen
if(bug_x < 0){
//bring it back in the screen
bug_x = 0;
}
//if the bug is touching the right side
if((bug_x + bug_size) > LCDWIDTH){
bug_x = LCDWIDTH - bug_size;
}
//if the bug is touching the top side
if(bug_y < 0){
bug_y = 0;
}
//if the bug is touching the down side
if((bug_y + bug_size) > LCDHEIGHT){
bug_y = LCDHEIGHT - bug_size;
}
//draw the bug on the screen
gb.display.drawChar(bug_x, bug_y, bug, 1);
int bug_x = LCDWIDTH/2; //set the horizontal position to the middle of the screen
//first screen
while(true){
if(gb.update()){
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("Work in progress"), logo);
}
Sun Jan 25, 2015 9:43 pm
Mon Jan 26, 2015 1:30 am
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
int bug_x = LCDWIDTH/2; //set the horizontal position to the middle of the screen
int bug_y = LCDHEIGHT/2; //vertical position
int bug_vx = 1; //horizontal velocity
int bug_vy = 1; //vertical velocity
int bug_size = 8; //the size of the ball in number of pixels
static unsigned char PROGMEM logo[]=
{
46,10,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B01111110, B01111000, B11111001, B11100110, B01100001, B10011000,
B01111110, B11111101, B11111011, B11110110, B01100001, B10011000,
B00011000, B11001101, B10000011, B00110111, B01100001, B10011000,
B00011000, B11111101, B11110011, B00110111, B11100001, B10011000,
B00011000, B11111100, B11111011, B00110111, B11100001, B11111000,
B11011000, B11001100, B00011011, B00110110, B11100001, B11111000,
B11111000, B11001101, B11111011, B11110110, B01101101, B10011000,
B11111000, B11001101, B11110001, B11100110, B01101101, B10011000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
};
static unsigned char PROGMEM bug[]=
{
8,8,
B01111110,
B11000011,
B10100101,
B10011001,
B10011001,
B10100101,
B11000011,
B01111110,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("Work in progress"), logo);
}
// the loop routine runs over and over again forever
void loop(){
while(true){
gb.update();
gb.battery.show = false;
//move the bug using the buttons
if(gb.buttons.repeat(BTN_RIGHT,2)){ //every 2 frames when the right button is held down
bug_x = bug_x + bug_vx; //increase the horizontal position by the bug's velocity
gb.sound.playTick(); //play a preset "tick" sound every time the button is pressed
}
if(gb.buttons.repeat(BTN_LEFT,2)){
bug_x = bug_x - bug_vx;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_DOWN,2)){
bug_y = bug_y + bug_vy;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_UP,2)){
bug_y = bug_y - bug_vy;
gb.sound.playTick();
}
//bonus : play a preset sound when A and B are pressed
if(gb.buttons.pressed(BTN_A)){
gb.sound.playOK();
}
if(gb.buttons.pressed(BTN_B)){
gb.sound.playCancel();
}
//check that the bug is not going out of the screen
//if the bug is touching the left side of the screen
if(bug_x < 0){
//bring it back in the screen
bug_x = 0;
}
//if the bug is touching the right side
if((bug_x + bug_size) > LCDWIDTH){
bug_x = LCDWIDTH - bug_size;
}
//if the bug is touching the top side
if(bug_y < 0){
bug_y = 0;
}
//if the bug is touching the down side
if((bug_y + bug_size) > LCDHEIGHT){
bug_y = LCDHEIGHT - bug_size;
}
//draw the bug on the screen
gb.display.drawBitmap(bug_x,bug_y,bug);
while(true){
if(gb.update()){
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
break;
}
}
}
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("Work in progress"), logo);
}
Tue Jan 27, 2015 2:37 pm
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
int bug_x = LCDWIDTH/2; //set the horizontal position to the middle of the screen
int bug_y = LCDHEIGHT/2; //vertical position
int bug_vx = 1; //horizontal velocity
int bug_vy = 1; //vertical velocity
int bug_size = 8; //the size of the ball in number of pixels
static unsigned char PROGMEM logo[]=
{
46,10,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B01111110, B01111000, B11111001, B11100110, B01100001, B10011000,
B01111110, B11111101, B11111011, B11110110, B01100001, B10011000,
B00011000, B11001101, B10000011, B00110111, B01100001, B10011000,
B00011000, B11111101, B11110011, B00110111, B11100001, B10011000,
B00011000, B11111100, B11111011, B00110111, B11100001, B11111000,
B11011000, B11001100, B00011011, B00110110, B11100001, B11111000,
B11111000, B11001101, B11111011, B11110110, B01101101, B10011000,
B11111000, B11001101, B11110001, B11100110, B01101101, B10011000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
};
static unsigned char PROGMEM bug[]=
{
8,8,
B01111110,
B11000011,
B10100101,
B10011001,
B10011001,
B10100101,
B11000011,
B01111110,
};
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("Work in progress"), logo);
}
// the loop routine runs over and over again forever
void loop(){
while(gb.update()){
gb.battery.show = false;
//move the bug using the buttons
if(gb.buttons.repeat(BTN_RIGHT,2)){ //every 2 frames when the right button is held down
bug_x = bug_x + bug_vx; //increase the horizontal position by the bug's velocity
gb.sound.playTick(); //play a preset "tick" sound every time the button is pressed
}
if(gb.buttons.repeat(BTN_LEFT,2)){
bug_x = bug_x - bug_vx;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_DOWN,2)){
bug_y = bug_y + bug_vy;
gb.sound.playTick();
}
if(gb.buttons.repeat(BTN_UP,2)){
bug_y = bug_y - bug_vy;
gb.sound.playTick();
}
//bonus : play a preset sound when A and B are pressed
if(gb.buttons.pressed(BTN_A)){
gb.sound.playOK();
bug_vx = 6;
bug_vy = 6;
}
if(gb.buttons.pressed(BTN_B)){
gb.sound.playCancel();
bug_vx = 2;
bug_vy = 2;
}
//check that the bug is not going out of the screen
//if the bug is touching the left side of the screen
if(bug_x < 0){
//bring it back in the screen
bug_x = 0;
}
//if the bug is touching the right side
if((bug_x + bug_size) > LCDWIDTH){
bug_x = LCDWIDTH - bug_size;
}
//if the bug is touching the top side
if(bug_y < 0){
bug_y = 0;
}
//if the bug is touching the down side
if((bug_y + bug_size) > LCDHEIGHT){
bug_y = LCDHEIGHT - bug_size;
}
//draw the bug on the screen
gb.display.drawBitmap(bug_x,bug_y,bug);
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
}
gb.update();{
//title screen to be able to get back to the game list
gb.titleScreen(F("Work in progress"), logo);
}
}