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: Sprites/Sprites-test.h
- Revision:
- 63:ec95e155fb30
- Child:
- 64:b373b6bf8255
diff -r 7574a7bbdf98 -r ec95e155fb30 Sprites/Sprites-test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sprites/Sprites-test.h Thu May 09 11:04:28 2019 +0000 @@ -0,0 +1,46 @@ +#ifndef SPRITE_TEST_H +#define SPRITE_TEST_H + + +#endif + +Sprites sprites; + +bool miner_movement() +{ + //initialises miner position then gets position. Checks that get_pos() function + // is obtaining miner position. This basically checks x position of miner + + sprites.miner_init(10,15); + + Vector2D p = sprites.get_pos(); + printf("%f, %f\n", p.x, p.y); + + bool success_flag = true; + + if (p.x != 10 && p.y != 15) { + success_flag = false; + } + return success_flag; +} + +bool gravity_check(N5110 &lcd) +{ + //takes miner position and checks that gravity function is working also + // checks that get_pos() is corectly obtaining y axis + bool success_flag = true; + + sprites.miner_init(10, 25); + Vector2D p = sprites.get_pos(); + + for (int i = 0; i < 10; i = i++) { + sprites.miner_gravity(lcd); + } + + if (p.x != 10 && p.y != 15) { // y position should have reduced by 10 + success_flag = false; + } + return success_flag; +} + +