Balint Bogdan SnekGame

Dependencies:   FoodLibrary Gamepad N5110 SnekGame mbed

Committer:
Nefos
Date:
Mon Mar 20 11:18:44 2017 +0000
Revision:
0:789c74742603
Child:
1:a222ad7a05b9
version 1.0 with basis for the code; comments indicate the need for code;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nefos 0:789c74742603 1 #include "mbed.h"
Nefos 0:789c74742603 2 #include "N5110.h"
Nefos 0:789c74742603 3
Nefos 0:789c74742603 4
Nefos 0:789c74742603 5 void loadMap();
Nefos 0:789c74742603 6 void getEnemy();
Nefos 0:789c74742603 7 void bomb();
Nefos 0:789c74742603 8
Nefos 0:789c74742603 9 //set LCD pins
Nefos 0:789c74742603 10 int heroChar[4]=(1,1,0,1);
Nefos 0:789c74742603 11 int bomb[4]=(0,1,0,1);
Nefos 0:789c74742603 12 int boulderLocation[4][8]={}// set the coordinate for boulder, if 00, boulder does not exist
Nefos 0:789c74742603 13
Nefos 0:789c74742603 14 int main()
Nefos 0:789c74742603 15 {
Nefos 0:789c74742603 16 lcd.init();//initializing display
Nefos 0:789c74742603 17
Nefos 0:789c74742603 18 while (true) {
Nefos 0:789c74742603 19 //draw the map
Nefos 0:789c74742603 20
Nefos 0:789c74742603 21 //draw top line (life)
Nefos 0:789c74742603 22
Nefos 0:789c74742603 23 //draw boulders
Nefos 0:789c74742603 24
Nefos 0:789c74742603 25 //draw characters at certain position
Nefos 0:789c74742603 26
Nefos 0:789c74742603 27 //draw bomb
Nefos 0:789c74742603 28
Nefos 0:789c74742603 29 //refresh
Nefos 0:789c74742603 30 wait(0.2f);
Nefos 0:789c74742603 31 }
Nefos 0:789c74742603 32 }
Nefos 0:789c74742603 33
Nefos 0:789c74742603 34
Nefos 0:789c74742603 35 void loadMap(){
Nefos 0:789c74742603 36 //get the size of the map and
Nefos 0:789c74742603 37 //use draw line for large lines
Nefos 0:789c74742603 38 //set pixel for small bts
Nefos 0:789c74742603 39 //look for boulders , if coordinate 00 ignore
Nefos 0:789c74742603 40 //draw boulder as bomb
Nefos 0:789c74742603 41 }
Nefos 0:789c74742603 42
Nefos 0:789c74742603 43 void drawHero(){
Nefos 0:789c74742603 44 //get the position first
Nefos 0:789c74742603 45 //draw {1,2} in first line
Nefos 0:789c74742603 46 //flip [3,4] for walking
Nefos 0:789c74742603 47
Nefos 0:789c74742603 48 }
Nefos 0:789c74742603 49
Nefos 0:789c74742603 50
Nefos 0:789c74742603 51 void bomb(){
Nefos 0:789c74742603 52 //get location
Nefos 0:789c74742603 53 //draw bomb
Nefos 0:789c74742603 54 //flip bomb do show its a bomb
Nefos 0:789c74742603 55 //if a boulder is at the range set0
Nefos 0:789c74742603 56
Nefos 0:789c74742603 57 }
Nefos 0:789c74742603 58