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: Mechanics/Mechanics.cpp
- Revision:
- 6:5f76dd718dc3
- Parent:
- 5:2d9f3c36bcb9
- Child:
- 7:2ce6e90f6d47
--- a/Mechanics/Mechanics.cpp Tue Feb 11 17:28:56 2020 +0000 +++ b/Mechanics/Mechanics.cpp Wed Feb 19 21:40:21 2020 +0000 @@ -119,7 +119,6 @@ } else { next_gate = 0; } - printf("%i ",next_gate); if(position.x >= gates[next_gate].TL.x && position.x <= gates[next_gate].BR.x && position.y <= gates[next_gate].TL.y && position.y >= gates[next_gate].BR.y) { return next_gate; @@ -143,4 +142,39 @@ } } return laps; -} \ No newline at end of file +} + +Time Mechanics::Convert_To_Time(int game_fps, int number_of_frames) +{ + int total_seconds = float(number_of_frames) / float(game_fps); + int seconds = total_seconds % 60; + float miliseconds_decimal = (float(number_of_frames) / float(game_fps)) - seconds; + int miliseconds = float(miliseconds_decimal * 1000); + int minuites = (total_seconds - seconds) / 60; + return {minuites, seconds, miliseconds}; +} + +//*************** +// BOOST PLATE +//*************** + +float Mechanics::Get_Boost_Speed(Triangle_2D plates[], int number_of_plates, Point_2D position, float speed) +{ + for(int i = 0; i < number_of_plates; i++) { + if(position.x > plates[i].TL.x && position.x < plates[i].BR.x && position.y < plates[i].TL.y && position.y > plates[i].BR.y) { + speed = 6; + } + } + return speed; +} + + + + + + + + + + +