RUOFAN LI / Mbed 2 deprecated el17rl

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers shot.cpp Source File

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 }