![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Owen Cavender 201159294
Diff: main.cpp
- Revision:
- 5:d716013c6a18
- Parent:
- 4:748e3ff14e72
- Child:
- 6:bf90044188d0
--- a/main.cpp Tue May 26 18:42:16 2020 +0000 +++ b/main.cpp Wed May 27 10:27:34 2020 +0000 @@ -58,19 +58,20 @@ void init() { - snake.init(); //need to initialise snake class + snake.init(engine); //need to initialise snake class pad.init(); lcd.init(); - engine.init(48, 24, 48, 30, 48, 47); // need to choose initial values A$AP shx shy apx apy Oshx, Oshy + engine.init(48, 24, 48, 30, 48, 23); // need to choose initial values A$AP int shx, int shy, int apx, int apy, int Oshx, int Oshy } void update_game_state() //FUNCTION 2 { snake.set_direction(pad); - snake.move_and_draw_snake(pad, lcd); + snake.move_snakebody(engine, lcd); + + snake.check_scored(lcd, pad, engine); snake.gameover_true(lcd); - snake.check_if_scored(lcd, pad); } @@ -95,15 +96,15 @@ void render() { - // clear screen, re-draw and refresh + lcd.clear(); lcd.drawRect(0, 0, 84, 42, FILL_TRANSPARENT); - Vector2D originalhead = engine.get_Snakehead(); //draw constant rectangle around frame of lcd indicating walls - Vector2D originalbody = engine.get_oldSnakehead(); + // Vector2D originalhead = engine.get_Snakehead(Snakehead); //draw constant rectangle around frame of lcd indicating walls + // Vector2D originalbody = engine.get_oldSnakehead(); - lcd.setPixel(originalhead.x, originalhead.y,1); - lcd.setPixel(originalbody.x, originalbody.y,1); - + // lcd.setPixel(originalhead.x, originalhead.y,1); + //lcd.setPixel(originalbody.x, originalbody.y,1); + lcd.refresh(); }