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: SpaceInvaderEngine/SpaceInvaderEngine.cpp
- Revision:
- 24:ff5af5a013b5
- Parent:
- 23:aa86e32b6a74
- Child:
- 27:eb755a345b1f
--- a/SpaceInvaderEngine/SpaceInvaderEngine.cpp Thu May 14 08:33:06 2020 +0000 +++ b/SpaceInvaderEngine/SpaceInvaderEngine.cpp Thu May 14 17:35:35 2020 +0000 @@ -11,7 +11,7 @@ } -void SpaceInvaderEngine::init(int ship_height, int ship_width, int alien_size, int no_aliens, int armada_column_size, int armada_row_size, int cover_y, int cover1_x, int cover2_x, int cover3_x, int no_rocks) { +void SpaceInvaderEngine::init(int ship_height, int ship_width, int alien_size, int no_aliens, int armada_column_size, int armada_row_size, int cover_y, int cover1_x, int cover2_x, int cover3_x, int no_rocks, int level) { S1_height = ship_height; S1_width = ship_width; @@ -31,7 +31,7 @@ C3x = cover3_x; NR = no_rocks; - A1.init(N,A1_size,CS,RS); + A1.init(N,A1_size,CS,RS,level); S1.init(S1_height,S1_width); C1.init(C1x,Cy,NR); C2.init(C2x,Cy,NR); @@ -54,11 +54,11 @@ C3.render(lcd); } -void SpaceInvaderEngine::update(Gamepad &pad, N5110 &lcd, int counter) +void SpaceInvaderEngine::update(Gamepad &pad, N5110 &lcd, int counter, int level) { get_ship_pos(); S1.update(D,Mag,pad,lcd,counter); - A1.update(pad, counter); + A1.update(pad, counter, level); ship_bullet_alien_collision(pad, lcd); ship_bullet_cover1_collision(pad, lcd); ship_bullet_cover2_collision(pad, lcd); @@ -103,6 +103,7 @@ bool F = false; A1.set_life(i,F); S1.set_bullet_hit(n,T); + pad.tone(600.0,0.2); } } } @@ -440,4 +441,5 @@ A1.set_bullet_hit(p,q,true); } } + S1.set_life(false); } \ No newline at end of file