From f066280c2f0fbbd838309c74f0e0996d4578ed43 Mon Sep 17 00:00:00 2001 From: Tom Tibs Date: Thu, 4 Jul 2019 03:35:20 -0500 Subject: [PATCH] cleaned up game.js a bit, still lots of work to do --- .idea/workspace.xml | 91 +++++++++++++++++++++++++++++++++++---------- game.js | 12 ++---- 2 files changed, 75 insertions(+), 28 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index aece3f5..e13f83c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -32,15 +53,35 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + @@ -65,6 +106,9 @@ console.log + + - + @@ -168,25 +214,24 @@ - - - + - + - + - + @@ -231,18 +276,24 @@ - - + + + + + + - - - - - - + + + + + + + + \ No newline at end of file diff --git a/game.js b/game.js index 037c7a0..1642fe7 100644 --- a/game.js +++ b/game.js @@ -30,17 +30,11 @@ const CTX = GAME_CANVAS.getContext("2d"); let WIDTH = GAME_CANVAS.width; let HEIGHT = GAME_CANVAS.height; - let horseWidth = WIDTH / 8; let horseHeight = WIDTH / 8; - - - - // state tracking const gameState = "running"; // this should probably be an enum later - const horses = []; @@ -79,6 +73,8 @@ function runRace(ctx,bg_ctx){ const y = HEIGHT / 2; const lane_1_height = HEIGHT - (horseHeight * 1.25); + //todo- change these sway varibles to be "trot" objects, or something, at put it in a horse object, so we can reuse these better + // horse 1 & 2 are hilarious, horse 3&4 are more normal paced const horse_1_sway = Math.sin(framecount) * 10; const horse_1_X_sway = Math.cos(framecount/3) * 10; @@ -108,11 +104,11 @@ function initHorses() { console.log("initHorses"); for (let i =0; i < 4; i ++ ){ const horse_image = new Image(); - horse_image.src = horse_image_array[i]; // todo - change to grab random horse image + horse_image.src = horse_image_array[i]; // todo - change to grab random horse horse_image.onload = function() { const horse = { image: horse_image - // todo - Draw the rest of the fucking owl + // todo - other horse things. } horses.push(horse); console.log("horseImagePushed");