From f95b91a64c55b9bfbc0cd76f8d971bc9a30279eb Mon Sep 17 00:00:00 2001 From: Alexander Bass Date: Tue, 21 Jun 2022 09:35:33 -0400 Subject: [PATCH] Unfinished particle system. Lost interest quickly. May come back later and rip it all out. --- index.js | 2 +- www/index.html | 3 ++- www/scripts/display/html.js | 8 ++++++-- www/scripts/display/particle.js | 26 ++++++++++++++++++++++++++ www/scripts/display/visualLoop.js | 6 +++--- www/scripts/script.js | 6 +++--- www/style.css | 8 +++++++- 7 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 www/scripts/display/particle.js diff --git a/index.js b/index.js index 182a280..bc85bd4 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ var express = require('express'); log.setMode(0); process.title = "Server" setInterval(function(){ updateInfo()},5000) -log.logRight(1, `Uptime: ${(performance.now() - startTime)/100}`); + function updateInfo() { log.setInfo(server.games) } diff --git a/www/index.html b/www/index.html index 931304c..92065bc 100644 --- a/www/index.html +++ b/www/index.html @@ -19,7 +19,8 @@

left

- + +

right

diff --git a/www/scripts/display/html.js b/www/scripts/display/html.js index c766296..927bfcd 100644 --- a/www/scripts/display/html.js +++ b/www/scripts/display/html.js @@ -4,8 +4,12 @@ export var canvas = document.getElementById('canvas'); export var ctx = canvas.getContext('2d'); export var hud = document.getElementById('hud'); export var hctx = hud.getContext('2d'); +export var parti = document.getElementById('parti'); +export var pctx = parti.getContext('2d'); canvas.width = game.tileSize*game.gridSize[0]; canvas.height = game.tileSize*game.gridSize[1]; -hud.width = canvas.width -hud.height = canvas.height +hud.width = canvas.width; +hud.height = canvas.height; +parti.width = canvas.width; +parti.height = canvas.height; diff --git a/www/scripts/display/particle.js b/www/scripts/display/particle.js new file mode 100644 index 0000000..247cb83 --- /dev/null +++ b/www/scripts/display/particle.js @@ -0,0 +1,26 @@ +class particleHandler { + constructor() { + + } + new(type, location) { + const id; + return id; + } + + destroy(id) { + + + } + + +} + +class particle { + constructor(id, type, location, timeout = 6) { + this.id = id; + this.type = type; + this.location = location; + this.timeout = timeout; + } + +} diff --git a/www/scripts/display/visualLoop.js b/www/scripts/display/visualLoop.js index 84662b0..87af434 100644 --- a/www/scripts/display/visualLoop.js +++ b/www/scripts/display/visualLoop.js @@ -1,9 +1,9 @@ import {render } from "./draw.js" -var RUNNING = false +var RUNNING = false; var animationStage = 0; export function start() { if (!RUNNING) { - RUNNING = true + RUNNING = true; loop(); } } @@ -19,7 +19,7 @@ export function get() { async function loop() { if (RUNNING === true) setTimeout(function(){ - if (animationStage < 2) { + if (animationStage < 6) { animationStage = animationStage + 1; } else { animationStage = 0; diff --git a/www/scripts/script.js b/www/scripts/script.js index 8e0cd9d..6dfa1c1 100644 --- a/www/scripts/script.js +++ b/www/scripts/script.js @@ -1,4 +1,4 @@ -import './display/draw.js'; -import './game/game.js' -import './interface/mainmenu/menu.js' +import '/scripts/display/draw.js'; +import '/scripts/game/game.js' +import '/scripts/interface/mainmenu/menu.js' import "/scripts/net/netcode.js" diff --git a/www/style.css b/www/style.css index 76fb3d8..0f6fdb3 100644 --- a/www/style.css +++ b/www/style.css @@ -107,10 +107,16 @@ span.button:hover { transform: translate(-50%, 0); } -.canvas2 { +.canvas2{ z-index: 1; position: absolute; transform: translate(-50%, 0); +} + +.canvas3 { + z-index: 2; + position: absolute; + transform: translate(-50%, 0); }