hgftf

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

snake.cpp

Committer:
ajorgih3
Date:
2020-11-16
Revision:
3:bb6f73642f01
Parent:
2:4947d6a82971
Child:
5:5953ca12205d

File content as of revision 3:bb6f73642f01:

// Copyright 2020 Georgia Tech.  All rights reserved.
// The materials provided by the instructor in this course are for
// the use of the students currently enrolled in the course.
// Copyrighted course materials may not be further disseminated.
// This file must not be made publicly available anywhere.

#include "snake.h"

void snake_init (Snake * s)
{
    s->score = 0;
    s->length = 3;
    s->head_px = 0;
    s->head_py = 0;
    s->head_y = 0;
    s->head_x = 0; 
    s->tail_x = 0;
    s->tail_y = 0; 
    s->tail_px = 0;
    s->tail_py = 0; 
    s->body_px = 0;
    s->body_py = 0;
    s->body_y = 0;
    s->body_x = 0;
    s->head_pi = 0;
    s->body_pi = 0;
    s->tail_pi = 0;
    s->head_pj = 0;
    s->body_pj = 0;
    s->tail_pj =  0;
    for (int i = 0; i < SNAKE_MAX_LENGTH; i++) {
        s->locations[i].x = 0;
        s->locations[i].y = 0; 
        }
    s->score = 0;
}