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.
Diff: ParentClasses/CheckCollisions/CheckCollision.cpp
- Revision:
- 85:87bc28b151d8
- Parent:
- 82:3211b31e9421
diff -r f61c85a5f13a -r 87bc28b151d8 ParentClasses/CheckCollisions/CheckCollision.cpp
--- a/ParentClasses/CheckCollisions/CheckCollision.cpp Tue May 26 14:39:45 2020 +0000
+++ b/ParentClasses/CheckCollisions/CheckCollision.cpp Tue May 26 19:38:48 2020 +0000
@@ -6,14 +6,14 @@
// printf ("Collision 1 = %d\n", collision);
// Checks collision if bullet is going in east direction
- if(bullet.get_direction()) {
+ if (bullet.get_direction()) {
// int bullet_pos_twox = bullet_pos.x;
// int bullet_pos_twoy = bullet_pos.y;
// printf ("alien x = %d, bullet x = %d\n", position_x_,bullet_pos_twox);
// printf ("alien y = %d, bullet y = %d\n", position_y_,bullet_pos_twoy);
// Collision if the bullet is inside of the xy ranges of sprite drawing
- if((bullet_pos.x + 1) >= position_x_ &&
+ if ((bullet_pos.x + 1) >= position_x_ &&
(bullet_pos.x + 1) <= (position_x_ + sprite_x_length ) &&
position_y_ <= bullet_pos.y &&
bullet_pos.y <= (position_y_ + sprite_y_length )) {
@@ -23,9 +23,9 @@
// printf ("Collision 2 = %d\n", collision);
// Checks collision if bullet is going in west direction
- }else if(!bullet.get_direction()) {
+ }else if (!bullet.get_direction()) {
- if(bullet_pos.x <= (position_x_ + sprite_x_length ) &&
+ if (bullet_pos.x <= (position_x_ + sprite_x_length ) &&
bullet_pos.x >= position_x_ &&
position_y_ <= bullet_pos.y &&
bullet_pos.y <= (position_y_ + sprite_y_length )) {