Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Snake/Snake-test.h
- Revision:
- 70:7caab8069b9b
- Parent:
- 69:55e309da7efd
- Child:
- 74:7b6568bc16d5
--- a/GameObjects/Snake/Snake-test.h Sat May 04 17:18:44 2019 +0000 +++ b/GameObjects/Snake/Snake-test.h Sat May 04 20:48:10 2019 +0000 @@ -18,23 +18,22 @@ snake.set_pos(initial_pos); // Read the position - Vector2D read_pos_1 = snake.get_pos(); + Vector2D read_pos_1 = snake.get_pos(0); printf("%f, %f\n", read_pos_1.x, read_pos_1.y); // Set the direction to W and set snake motion free by setting b as 1; Direction d = W; - int b[15]; //each element in this array represents the beed number in the snake. - for(int i=0; i<=13; i++) { + int b[10]; //each element in this array represents the beed number in the snake. + for(int i=0; i<=9; i++) { b[i] = 1; } - b[14] = 1; // Update the snake position snake.update(d, b); // Read the position - Vector2D read_pos_2 = snake.get_pos(); + Vector2D read_pos_2 = snake.get_pos(0); printf("%f, %f\n", read_pos_2.x, read_pos_2.y); // Now check that both the positions are as expected