The game is finished

Dependencies:   mbed Gamepad N5110 mbed-rtos

Committer:
RexRoshan
Date:
Thu May 09 14:23:35 2019 +0000
Revision:
14:c7302ffe6eab
Parent:
7:574c66ebd8b0
Final Modification

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RexRoshan 7:574c66ebd8b0 1 #include "Background.h"
RexRoshan 7:574c66ebd8b0 2
RexRoshan 7:574c66ebd8b0 3 // nothing doing in the constructor and destructor
RexRoshan 7:574c66ebd8b0 4 Background::Background()
RexRoshan 7:574c66ebd8b0 5 {
RexRoshan 7:574c66ebd8b0 6
RexRoshan 7:574c66ebd8b0 7 }
RexRoshan 7:574c66ebd8b0 8
RexRoshan 7:574c66ebd8b0 9 Background::~Background()
RexRoshan 7:574c66ebd8b0 10 {
RexRoshan 7:574c66ebd8b0 11
RexRoshan 7:574c66ebd8b0 12 }
RexRoshan 7:574c66ebd8b0 13
RexRoshan 7:574c66ebd8b0 14 // upper cloud
RexRoshan 7:574c66ebd8b0 15
RexRoshan 7:574c66ebd8b0 16 int upper_cloud [18][16] = {
RexRoshan 7:574c66ebd8b0 17
RexRoshan 7:574c66ebd8b0 18 {1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 19 {1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 20 {0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 21 {0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 22 {0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 23 {0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 24 {0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 25 {0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 26 {1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 27 {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 28 {1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0},
RexRoshan 7:574c66ebd8b0 29 {0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0},
RexRoshan 7:574c66ebd8b0 30 {0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0},
RexRoshan 7:574c66ebd8b0 31 {0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0},
RexRoshan 7:574c66ebd8b0 32 {0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0},
RexRoshan 7:574c66ebd8b0 33 {0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0},
RexRoshan 7:574c66ebd8b0 34 {0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0},
RexRoshan 7:574c66ebd8b0 35 {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 36
RexRoshan 7:574c66ebd8b0 37 };
RexRoshan 7:574c66ebd8b0 38
RexRoshan 7:574c66ebd8b0 39 int lower_cloud [16][17] = {
RexRoshan 7:574c66ebd8b0 40 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
RexRoshan 7:574c66ebd8b0 41 {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0},
RexRoshan 7:574c66ebd8b0 42 {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1},
RexRoshan 7:574c66ebd8b0 43 {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1},
RexRoshan 7:574c66ebd8b0 44 {0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,1,0},
RexRoshan 7:574c66ebd8b0 45 {0,0,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0},
RexRoshan 7:574c66ebd8b0 46 {0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0},
RexRoshan 7:574c66ebd8b0 47 {1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 48 {1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 49 {1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 50 {0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 51 {0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 52 {0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 53 {1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 54 {1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 55 {0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0},
RexRoshan 7:574c66ebd8b0 56
RexRoshan 7:574c66ebd8b0 57 };
RexRoshan 7:574c66ebd8b0 58
RexRoshan 7:574c66ebd8b0 59
RexRoshan 7:574c66ebd8b0 60 void Background::init_u(int a,int b) // initialising the x and y position of the clouds
RexRoshan 7:574c66ebd8b0 61 {
RexRoshan 7:574c66ebd8b0 62
RexRoshan 7:574c66ebd8b0 63 _a = a; // x position of the upper cloud
RexRoshan 7:574c66ebd8b0 64 _b = b; // y position of the upper cloud
RexRoshan 7:574c66ebd8b0 65
RexRoshan 7:574c66ebd8b0 66 }
RexRoshan 7:574c66ebd8b0 67
RexRoshan 7:574c66ebd8b0 68 void Background::init_l(int c,int d) // initialising the x and y position of the clouds
RexRoshan 7:574c66ebd8b0 69 {
RexRoshan 7:574c66ebd8b0 70
RexRoshan 7:574c66ebd8b0 71 _c = c; // x position of the lower cloud
RexRoshan 7:574c66ebd8b0 72 _d = d; // y position of the lower cloud
RexRoshan 7:574c66ebd8b0 73
RexRoshan 7:574c66ebd8b0 74 }
RexRoshan 7:574c66ebd8b0 75
RexRoshan 7:574c66ebd8b0 76 void Background::background(N5110 &lcd)
RexRoshan 7:574c66ebd8b0 77 {
RexRoshan 7:574c66ebd8b0 78
RexRoshan 7:574c66ebd8b0 79 // Draws the clouds
RexRoshan 7:574c66ebd8b0 80 lcd.drawSprite(_a,_b,18,16,(int *)upper_cloud);
RexRoshan 7:574c66ebd8b0 81 lcd.drawSprite(_c, _d, 16, 17, (int *)lower_cloud);
RexRoshan 7:574c66ebd8b0 82 }
RexRoshan 7:574c66ebd8b0 83
RexRoshan 7:574c66ebd8b0 84 void Background::update() // Moves the position of the cloud everytime
RexRoshan 7:574c66ebd8b0 85 {
RexRoshan 7:574c66ebd8b0 86
RexRoshan 7:574c66ebd8b0 87 _fast = 1.0; // Movement speed = 1 so that it is not too fast
RexRoshan 7:574c66ebd8b0 88
RexRoshan 7:574c66ebd8b0 89 _a+=_fast;
RexRoshan 7:574c66ebd8b0 90 _c+=_fast; // moves the x-position to the right
RexRoshan 7:574c66ebd8b0 91
RexRoshan 7:574c66ebd8b0 92
RexRoshan 7:574c66ebd8b0 93 }
RexRoshan 7:574c66ebd8b0 94
RexRoshan 7:574c66ebd8b0 95
RexRoshan 7:574c66ebd8b0 96 Vector2D Background::get_pos_upper() {
RexRoshan 7:574c66ebd8b0 97 //gets the position of the clouds
RexRoshan 7:574c66ebd8b0 98 Vector2D e = {_a,_b};
RexRoshan 7:574c66ebd8b0 99 return e;
RexRoshan 7:574c66ebd8b0 100 }
RexRoshan 7:574c66ebd8b0 101
RexRoshan 7:574c66ebd8b0 102 Vector2D Background::get_pos_lower() {
RexRoshan 7:574c66ebd8b0 103 //gets the position of the clouds
RexRoshan 7:574c66ebd8b0 104 Vector2D f = {_c,_d};
RexRoshan 7:574c66ebd8b0 105 return f;
RexRoshan 7:574c66ebd8b0 106 }
RexRoshan 7:574c66ebd8b0 107
RexRoshan 7:574c66ebd8b0 108 void Background::set_pos_upper(Vector2D e)
RexRoshan 7:574c66ebd8b0 109 {
RexRoshan 7:574c66ebd8b0 110 //sets the position of the first enemy of stage 2
RexRoshan 7:574c66ebd8b0 111 _a = e.x;
RexRoshan 7:574c66ebd8b0 112 _b = e.y;
RexRoshan 7:574c66ebd8b0 113 }
RexRoshan 7:574c66ebd8b0 114
RexRoshan 7:574c66ebd8b0 115 void Background::set_pos_lower(Vector2D f)
RexRoshan 7:574c66ebd8b0 116 {
RexRoshan 7:574c66ebd8b0 117 //sets the position of the first enemy of stage 2
RexRoshan 7:574c66ebd8b0 118 _c = f.x;
RexRoshan 7:574c66ebd8b0 119 _d = f.y;
RexRoshan 7:574c66ebd8b0 120 }