Manic Miner platform game for FRDM K64F board
Embed:
(wiki syntax)
Show/hide line numbers
Sprites-test.h
00001 #ifndef SPRITE_TEST_H 00002 #define SPRITE_TEST_H 00003 00004 #endif 00005 00006 Sprites sprites; 00007 00008 bool miner_movement() 00009 { 00010 //initialises miner position then gets position. Checks that get_pos() function 00011 // is obtaining miner position. This basically checks x position of miner 00012 00013 sprites.miner_init(10,15); 00014 00015 Vector2D p = sprites.get_pos(); 00016 printf("%f, %f\n", p.x, p.y); 00017 00018 bool success_flag = true; 00019 00020 if (p.x != 10 && p.y != 15) { 00021 success_flag = false; 00022 } 00023 return success_flag; 00024 } 00025 00026 bool gravity_check(N5110 &lcd) 00027 { 00028 //takes miner position and checks that gravity function is working also 00029 // checks that get_pos() is corectly obtaining y position 00030 bool success_flag = true; 00031 00032 sprites.miner_init(10, 25); 00033 Vector2D p = sprites.get_pos(); 00034 00035 for (int i = 0; i < 10; i = i++) { 00036 sprites.miner_gravity(lcd); 00037 } 00038 00039 if (p.x != 10 && p.y != 15) { // y position should have reduced by 10 00040 success_flag = false; 00041 } 00042 return success_flag; 00043 }
Generated on Sun Jul 17 2022 12:54:21 by
1.7.2