Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Boss.cpp
00001 #include "Boss.h" 00002 00003 Boss::Boss() 00004 { 00005 00006 } 00007 00008 Boss::~Boss() 00009 { 00010 00011 } 00012 00013 int Bosss[4][6] = { 00014 {1,1,1,1,1,1}, 00015 {1,1,1,1,1,1}, 00016 {0,0,1,1,0,0}, 00017 {0,0,1,1,0,0}, 00018 }; 00019 00020 void Boss::init(int height, int width, int speed) 00021 { 00022 _height = height; 00023 _width = width; 00024 _x = rand() % 65; //set the boss original position 00025 _y = 2; 00026 00027 srand(time(NULL)); 00028 00029 _velocity.x = 0; 00030 _velocity.y = speed; 00031 } 00032 00033 void Boss::draw(N5110 &lcd) 00034 { 00035 lcd.drawSprite(_x,_y,_height,_width,(int*)Bosss); 00036 } 00037 00038 void Boss::update() 00039 { 00040 _x += _velocity.x; 00041 _y += _velocity.y; 00042 } 00043 00044 void Boss::set_velocity(Vector2D v) 00045 { 00046 _velocity.x = v.x; 00047 _velocity.y = v.y; 00048 } 00049 00050 Vector2D Boss::get_velocity() 00051 { 00052 Vector2D v = {_velocity.x,_velocity.y}; 00053 return v; 00054 } 00055 00056 Vector2D Boss::get_pos() 00057 { 00058 Vector2D p = {_x,_y}; 00059 return p; 00060 } 00061 00062 void Boss::set_pos(Vector2D p) 00063 { 00064 _x = p.x; 00065 _y = p.y; 00066 } 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076
Generated on Sat Aug 20 2022 05:26:48 by
1.7.2