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 MotionSensor
Diff: Entity/Snake/Snake.cpp
- Revision:
- 27:a1b41626f57c
- Parent:
- 23:5a8f75e93508
- Child:
- 28:98848e6a77a2
diff -r abbc19edc5c1 -r a1b41626f57c Entity/Snake/Snake.cpp
--- a/Entity/Snake/Snake.cpp Mon Apr 29 02:45:17 2019 +0000
+++ b/Entity/Snake/Snake.cpp Mon Apr 29 10:39:09 2019 +0000
@@ -46,7 +46,7 @@
}
// Functions
-void Snake::move(float player_x, float player_y)
+void Snake::move(float player_x, float player_y, int * map)
{
std::complex<double> pos_diff(player_x - position.x, player_y - position.y); // defining difference in position as a vector
velocity = velocity_pattern[_velocity_index]; // Creating slithering effect, changing velocity of movement
@@ -84,8 +84,8 @@
update_hitbox(7, 4, 12, 7, 0, 4, 4);
}
- undo_move_x(matrix_collision_test(position.x, prev_pos.y, 0));
- undo_move_y(matrix_collision_test(prev_pos.x, position.y, 0));
+ undo_move_x(matrix_collision_test(position.x, prev_pos.y, map));
+ undo_move_y(matrix_collision_test(prev_pos.x, position.y, map));
frame.count++;
if (frame.count >= 10) {