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
Sprites/Sprites-test.h
- Committer:
- el17arm
- Date:
- 2019-05-09
- Revision:
- 68:8f4658b9eb0f
- Parent:
- 64:b373b6bf8255
File content as of revision 68:8f4658b9eb0f:
#ifndef SPRITE_TEST_H
#define SPRITE_TEST_H
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 position
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;
}
#endif