![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
tao lao
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
snake.cpp@3:33bf11645fe1, 2020-11-24 (annotated)
- Committer:
- hnguyen403
- Date:
- Tue Nov 24 05:05:10 2020 +0000
- Revision:
- 3:33bf11645fe1
- Parent:
- 2:4947d6a82971
tao lao;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DCchico | 2:4947d6a82971 | 1 | // Copyright 2020 Georgia Tech. All rights reserved. |
DCchico | 2:4947d6a82971 | 2 | // The materials provided by the instructor in this course are for |
DCchico | 2:4947d6a82971 | 3 | // the use of the students currently enrolled in the course. |
DCchico | 2:4947d6a82971 | 4 | // Copyrighted course materials may not be further disseminated. |
DCchico | 2:4947d6a82971 | 5 | // This file must not be made publicly available anywhere. |
DCchico | 2:4947d6a82971 | 6 | |
DCchico | 1:10330bce85cb | 7 | #include "snake.h" |
DCchico | 1:10330bce85cb | 8 | |
DCchico | 1:10330bce85cb | 9 | void snake_init (Snake * s) |
DCchico | 1:10330bce85cb | 10 | { |
hnguyen403 | 3:33bf11645fe1 | 11 | s->head_x = 0; |
hnguyen403 | 3:33bf11645fe1 | 12 | s->head_px =0; |
hnguyen403 | 3:33bf11645fe1 | 13 | s->head_y = 0; |
hnguyen403 | 3:33bf11645fe1 | 14 | s->head_py =0; |
hnguyen403 | 3:33bf11645fe1 | 15 | s->length = 3; |
hnguyen403 | 3:33bf11645fe1 | 16 | |
hnguyen403 | 3:33bf11645fe1 | 17 | for (int i = 0; i < SNAKE_MAX_LENGTH; i++) |
hnguyen403 | 3:33bf11645fe1 | 18 | {s->locations[i].x = s->head_px; |
hnguyen403 | 3:33bf11645fe1 | 19 | s->locations[i].y = s->head_py;} |
hnguyen403 | 3:33bf11645fe1 | 20 | s->score = 0; //Current score of the snake |
DCchico | 1:10330bce85cb | 21 | } |