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.
Dependencies: mbed
SpaceInvadersEngine/SpaceInvadersEngine.cpp
- Committer:
- fy14lkaa
- Date:
- 2019-04-27
- Revision:
- 64:8ccfdd24a582
- Parent:
- 63:5a33437d2267
- Child:
- 65:6105f47929dd
File content as of revision 64:8ccfdd24a582:
#include "SpaceInvadersEngine.h"
SpaceInvadersEngine::SpaceInvadersEngine()
{
}
SpaceInvadersEngine::~SpaceInvadersEngine()
{
}
void SpaceInvadersEngine::init(int space_ship_width,int space_ship_height,int bullet_size, int Alien_size, int speed)
{
    // initialise the game parameters
    _space_ship_width= space_ship_width;
    _space_ship_height= space_ship_height;
    _bullet_size= bullet_size;
    _Alien_size= Alien_size;
    _speed= speed;
}
void  SpaceInvadersEngine::read_input(Gamepad &pad)
{
    _d = pad.get_direction();
    _mag = pad.get_mag();
}
void  SpaceInvadersEngine::draw(N5110 &lcd)
{
    // draw the elements in the LCD buffer
    // pitch
    //score
    print_scores(lcd);
    _Alien.draw(lcd);
    _space_ship.draw(lcd);
    _bullet.draw(lcd);
}
void  SpaceInvadersEngine::update(Gamepad &pad)
{
    check_goal(pad);
        _bullet.update();
        _space_ship.update(_d,_mag);
        _A1ien.update(_d,_mag);
    }
    void SpaceInvadersEngine::check_wall_collision(Gamepad &pad) {
        // read current Alien attributes
        Vector2D Alien_pos = _Alien.get_pos();
        Vector2D Alien_velocity = _Alien.get_velocity();
    }