Game using Classes

Kendra Hoyt
1 min readMar 7, 2021

Homework 7 — March 6th, 2021

let screen = 0; → This is to define game state

let y=-20;

let x=200;

let speed = 2;

let score= 0; → works with power

let tummy = 20; → Kims body as she eat

let food; → the objects that appear

let power = 0; → when Kim eats she gains power (score)

Functions:

  • Field → the grid in which Kim moves
  • MousePressed → Start game
  • Draw → Background, Power display, transition from game states
  • startScreen → intro page
  • GameOn → the background display
  • Kim → the snake

Class:

  • Green → moving background

--

--