Added a bunch of unprofessional stuff, created a new github account so its not linked to me professionally, pushed directly to master. NBD.

This commit is contained in:
2019-07-26 01:20:45 -05:00
parent 1b31f9cd15
commit ca4327e524
31 changed files with 153 additions and 54 deletions

56
game.js
View File

@@ -6,10 +6,20 @@ let cyclesRemaining = 1000;
const horse_array = [
{img: "./resources/horse_images/final/stonewall_000.png", name: "Stonewall"},
{img: "./resources/horse_images/final/DEMON_HORZE_666.png", name: "DEMON HORZE"},
{img: "./resources/horse_images/final/CrotchRocket_93_raw.png", name: "CROTCH ROCKET"},
{img: "./resources/horse_images/final/BlackJack_10.png", name: "BlackJack"}
{img: "./resources/horse_images/final/a_horse.png", name: "A Horse" , owner: "Ola"},
{img: "./resources/horse_images/final/BlackJack_10.png", name: "BlackJack", owner: "Jenn"},
{img: "resources/horse_images/final/char_azNEIGHHble.png", name: "Char AzNIEGHHble" , owner: "Riley"},
{img: "./resources/horse_images/final/CrotchRocket_93_raw.png", name: "CROTCH ROCKET", owner: "Ben"},
{img: "./resources/horse_images/final/DEMON_HORZE_666.png", name: "DEMON HORZE" , owner: "Ski"},
{img: "./resources/horse_images/final/dickzilla.png", name: "DickZilla" , owner: "Alex"},
{img: "./resources/horse_images/final/f-TheHaters.png", name: "Fuck the Haters" , owner: "Carlos"},
{img: "./resources/horse_images/final/GH.png", name: "GH" , owner: "Skoo"},
{img: "./resources/horse_images/final/Horse_cock.png", name: "Horse Cock" , owner: "Ben"},
{img: "./resources/horse_images/final/horse_san_69.png", name: "Horse-San" , owner: "Riley"},
{img: "./resources/horse_images/final/killme112.png", name: "Kill Me" , owner: "Quinn"},
{img: "./resources/horse_images/final/lil_sebastian.png", name: "Lil' Sebastian" , owner: "Horsey Heaven"},
{img: "./resources/horse_images/final/stonewall_000.png", name: "Stonewall", owner: "Davie"},
];
@@ -83,9 +93,17 @@ function gameLoop(){
if (!fanfarePlayedFlag){
playFanfare();
fanfarePlayedFlag = true;
setTimeout(()=>{
gameState = "WinnerCloseUp";
}, 7 * 1000);
}
CTX.clearRect(0, 0, WIDTH, HEIGHT);
drawResults(BG_CTX, WIDTH, HEIGHT, horseHeight, finalPlaces);
break;
case "WinnerCloseUp":
drawWinnerCloseUp(BG_CTX, WIDTH, HEIGHT, horseHeight, finalPlaces);
break;
default:
break;
}
@@ -215,14 +233,38 @@ function runRace(ctx,bg_ctx){
function initHorses() {
console.log("initHorses");
const temp_horse_array = [];
//grab random horses
while (temp_horse_array.length < 4) {
let validPick = true;
// pick an index
let pick = Math.floor(Math.random() * horse_array.length);
// check if its taken
for (let i =0; i < temp_horse_array.length; i ++){
if (temp_horse_array[i].name === horse_array[pick].name){ validPick = false;}
}
//push to temp array
if (validPick){
temp_horse_array.push(horse_array[pick]);
}
console.log(temp_horse_array);
}
// build horse game play objects
for (let i =0; i < 4; i ++ ){
console.log(i);
const horse_image = new Image();
horse_image.src = horse_array[i].img; // todo - change to grab random horse
const tempName = horse_array[i].name; //
horse_image.src = temp_horse_array[i].img;
const temphorse = temp_horse_array[i];
horse_image.onload = function() {
const horse = {
image: horse_image,
name: tempName,
name: temphorse.name,
owner: temphorse.owner,
x:0,
y:0,
currentSpeed: null,