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
Diff: Ship/Ship.cpp
- Revision:
- 11:73cd744ffa80
- Parent:
- 9:241a1a7d8527
- Child:
- 12:47578eb9ea73
--- a/Ship/Ship.cpp Tue Apr 09 06:43:01 2019 +0000 +++ b/Ship/Ship.cpp Tue Apr 09 11:21:18 2019 +0000 @@ -17,6 +17,18 @@ { 1,0,1,1,0,1,1,0,1 }, { 0,1,1,1,1,1,1,1,0 }, }; +const int imperion[10][7] = { + {0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0}, + {1,1,0,0,0,1,1}, + {0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0}, + {0,1,1,0,1,1,0}, + {1,0,0,1,0,0,1}, + {0,0,1,0,1,0,0}, + {0,0,0,1,0,0,0}, +}; /* int basic_width = 9; int basic_height = 6; @@ -38,6 +50,10 @@ { lcd.drawSprite(_ship_xpos,_ship_ypos,6,9,(int *)basic); } +void Ship::draw_imperion(N5110 &lcd) +{ + lcd.drawSprite(_ship_xpos,_ship_ypos,10,7,(int *)imperion); +} void Ship::update_ship(float x_joystick,float y_joystick) { // Only change position if joystick is reasonably moved @@ -72,6 +88,15 @@ return ship_pos; } +void Ship::set_ship(int ship_width, int ship height, int ship_xpos, int ship_ypos) +{ + _ship_width = ship_width; + _ship_height = ship_height; + _ship_xpos = ship_xpos; + _ship_xpos = ship_ypos; + +} + /****Note: if you make all the ships the same size, you could then creare a enum for them ship.[ enum class Ship {basic, devotion}; ] then, you can declare a new variable belonging to the enum Ship, ship. then to set a ships sprite simply use the variable to test if the ship is correct and create an if function to draw the appropriate ship