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.
shot.cpp
00001 #include "shot.h" 00002 00003 Shot::Shot() 00004 { 00005 00006 } 00007 00008 Shot::~Shot() 00009 { 00010 00011 } 00012 00013 00014 void Shot::init(int x,int y,int width,int height, int velocity) 00015 { 00016 _x = x; 00017 _y = y; //set position of shot 00018 _width = width; 00019 _height = height; 00020 _speed = 3; 00021 } 00022 00023 void Shot::draw(N5110,lcd) 00024 { 00025 int Shot[3][5] = { 00026 0,1,0 , 00027 1,1,1 , 00028 0,1,0 , 00029 1,1,1 , 00030 1,1,1 , 00031 }; 00032 Bitmap sprite(Shot, _width, _height); 00033 sprite.render(lcd, _x, _y); 00034 } 00035 00036 void Shot::update() 00037 { 00038 _y-=_speed; 00039 } 00040 00041 Vector2D Bullet::get_Pos() 00042 { 00043 Vector2D p = {_x,_y}; 00044 return p; 00045 }
Generated on Wed Jul 13 2022 13:02:18 by
