Yippie Kayak
Team Members
Rajan Tayal
Jerett Lupoli
Video Game
Extreme Kayaking is a basic dodge based video game that is controlled via bluetooth and the UART app. The game starts by letting the user select a kayak. The selection is done using the four numbered buttons on the phone. Then the users kayak is placed in the river and they must uses the directional arrows to dodge rocks to make it down the river.
Game Design
Extreme Kayaking is done using object oriented program techniques in C++. The rocks and kayak are a created class which has variables for position and functions for movement and response. It also takes advantage of the ULCDs ability to print the rocks and kayak animations to the screen.
Game Hardware
The game is run using the Mbed, ULCD-144, Adafruit Bluetooth LE UART friend, and any phone with the bluefruit app. The ULCD-144 uses a serial interface to connect with the mbed and display the game. The Bluetooth LE UART allows the phone to wirelessly communicate to the mbed. The chip has a serial connection to the mbed to allow data transfer.
More information about the parts can be found here.
The connections from each component to the mbed are as follows.
mbed | Adafruit BLE |
---|---|
gnd | gnd |
VU(5v) | Vin (3.3-16V) |
nc | RTS |
Gnd | CTS |
p27 (Serial RX) | TXO |
p28 (Serial TX) | RXI |
mbed | uLCD Header | uLCD cable |
---|---|---|
5V=VU | 5V | 5V |
Gnd | Gnd | Gnd |
TX=P9 | RX | TX |
RX=P10 | TX | RX |
P11 | Reset | Reset |
Game Software
main.cpp
#include "mbed.h" #include "uLCD_4DGL.h" #include "screens.h" #include "object.h" #include "utils.h" #include <ctime> // For time() #include <cstdlib> #define ROCK_HEIGHT 20 #define ROCK_WIDTH 20 #define SPRITE_MAX 15 #define SPLASH_WIDTH 20 #define KAYAK_WIDTH 6 #define KAYAK_HEIGHT 20 #define MAX_ROCKS 10 // change this if ya want #define Q 0x808000 //OLIVE #define I 0x008000 //GREEN #define S 0xC0C0C0 //SILVER #define C 0x17202A //UFO GLASS #define D 0x797D7F //DARK GREY #define L 0x00FF00 //LIME #define P 0xFF00FF //PINK #define R 0xF1C40F //YELLOW #define O 0xF39C12 //ORANGE #define G 0xAAB7B8 //GREY #define _ 0x000000 //BLACK #define X 0xFFFFFF //WHITE #define B 0x0000FF //BLUE #define r 0xFF0000 //RED uLCD_4DGL uLCD(p9, p10, p11); Serial pc(USBTX, USBRX); RawSerial blue(p28, p27); int main() { mainMenu(); uLCD.cls(); uLCD.text_string("Choose a kayak", 2, 2, FONT_7X8, WHITE); uLCD.text_string("1", 4, 5, FONT_7X8, WHITE); uLCD.BLIT(30, 50, KAYAK_WIDTH, 20, Player_Kayak1); uLCD.text_string("3", 4, 10, FONT_7X8, WHITE); uLCD.BLIT(78, 50, KAYAK_WIDTH, 20, Player_Kayak2); uLCD.text_string("2", 11, 5, FONT_7X8, WHITE); uLCD.BLIT(30, 90, KAYAK_WIDTH, 20, Player_Kayak3); uLCD.text_string("4", 11, 10, FONT_7X8, WHITE); uLCD.BLIT(78, 90, KAYAK_WIDTH, 20, Player_Kayak4); Kayak k; bool selection = false; while(!selection){ if (blue.readable()){ if (blue.getc() == '!'){ if(blue.getc() == 'B') { char dir = blue.getc(); char on = blue.getc(); if (dir == '1' && on == '1') { k.setImage(1); selection = true; } if (dir == '2' && on == '1') { k.setImage(2); selection = true; } if (dir == '3' && on == '1') { k.setImage(3); selection = true; } if (dir == '4' && on == '1') { k.setImage(4); selection = true; } } } } } //game uLCD.cls(); Rock rock1; Rock rock2; Rock rock3; Rock rock4; Rock rock5; Rock rock6; Rock rock7; Rock rock8; Rock rock9; Rock rock10; Rock rock11; Rock rock12; k.create(); rock1.visible = true; rock2.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock1.move(); rock2.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } rock3.visible = true; rock4.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock1.move(); rock2.move(); rock3.move(); rock4.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } rock5.visible = true; rock6.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock1.move(); rock2.move(); rock3.move(); rock4.move(); rock5.move(); rock6.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock1.col | k.col== rock2.col){ death(); } rock1.visible = false; rock2.visible = false; rock7.visible = true; rock8.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock3.move(); rock4.move(); rock5.move(); rock6.move(); rock7.move(); rock8.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock3.col | k.col== rock4.col){ death(); } rock3.visible = false; rock4.visible = false; rock9.visible = true; rock10.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock5.move(); rock6.move(); rock7.move(); rock8.move(); rock9.move(); rock10.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock5.col | k.col== rock6.col){ death(); } rock5.visible = false; rock6.visible = false; rock11.visible = true; rock12.visible = true; for(int i=0; i<2; i++){ k.check(); k.create(); rock7.move(); rock8.move(); rock9.move(); rock10.move(); rock11.move(); rock12.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock7.col | k.col== rock8.col){ death(); } rock7.visible = false; rock8.visible = false; for(int i=0; i<2; i++){ k.check(); k.create(); rock9.move(); rock10.move(); rock11.move(); rock12.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock9.col | k.col== rock10.col){ death(); } rock9.visible = false; rock10.visible = false; for(int i=0; i<2; i++){ k.check(); k.create(); rock11.move(); rock12.move(); k.check(); k.create(); wait(0.1); uLCD.cls(); } if (k.col== rock11.col | k.col== rock12.col){ death(); } winScreen(); }
Import programYippieKayak
KayakingGame
Game Demo
Please log in to post comments.