Get old demo running

This commit is contained in:
Tangent Wantwight 2020-01-19 01:24:29 -05:00
parent 105ab7af03
commit 5fed6ea82f
6 changed files with 1399 additions and 1358 deletions

2730
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,14 +4,16 @@
"description": "Sacrifices must be made", "description": "Sacrifices must be made",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "webpack", "build": "parcel build src/index.html",
"buildProduction": "webpack --mode=production", "clean": "rimraf .cache dist",
"live": "parcel src/index.html",
"tsc:check": "tsc --noEmit" "tsc:check": "tsc --noEmit"
}, },
"author": "Tangent 128", "author": "Tangent 128",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"parcel-bundler": "^1.12.4", "parcel-bundler": "^1.12.4",
"rimraf": "^3.0.0",
"sass": "^1.23.7", "sass": "^1.23.7",
"typescript": "^3.7.3" "typescript": "^3.7.3"
} }

View file

@ -111,7 +111,8 @@ export class LoopTest {
const layer = new Layer(0); const layer = new Layer(0);
const drawSet = new DrawSet(); const drawSet = new DrawSet();
const spinnerId = Create(this.data, { // spinner box
Create(this.data, {
location: new Location({ location: new Location({
X: 200, X: 200,
Y: 200, Y: 200,
@ -125,10 +126,12 @@ export class LoopTest {
) )
}); });
const triangleId = Create(this.data, { // triangles
[0, 1, 2, 3, 4, 5].forEach(angle => Create(this.data, {
location: new Location({ location: new Location({
X: 200, X: 200,
Y: 200, Y: 200,
Angle: angle,
VAngle: -Math.PI/10 VAngle: -Math.PI/10
}), }),
bounds: new Polygon([70, 0, 55, 40, 85, 40]), bounds: new Polygon([70, 0, 55, 40, 85, 40]),
@ -137,16 +140,19 @@ export class LoopTest {
"#d40", "#d40",
layer layer
) )
}); }));
const loop = new Loop(30, const loop = new Loop(30,
interval => { interval => {
DumbMotion(this.data, interval); DumbMotion(this.data, interval);
const [triangleDebug] = Lookup(this.data, triangleId, "renderBounds"); Join(this.data, "collisionSourceClass", "renderBounds").forEach(([collisionSourceClass, renderBounds]) => {
if(triangleDebug) triangleDebug.color = "#d40"; if(collisionSourceClass.name === "tri") {
renderBounds.color = "#d40";
}
});
FindCollisions(this.data, 500, (className, sourceId, targetId) => { FindCollisions(this.data, 500, (className, sourceId, _targetId) => {
switch(className) { switch(className) {
case "tri>block": case "tri>block":
const [debug] = Lookup(this.data, sourceId, "renderBounds"); const [debug] = Lookup(this.data, sourceId, "renderBounds");

1
src/Game/Main.ts Normal file
View file

@ -0,0 +1 @@
import {} from "./GameComponents";

View file

@ -4,6 +4,7 @@
<title></title> <title></title>
<link rel="stylesheet" href="./index.scss" /> <link rel="stylesheet" href="./index.scss" />
</head><body> </head><body>
<canvas id="RenderTest" width="500" height="400"></canvas>
<canvas id="GameCanvas" width="500" height="400"></canvas> <canvas id="GameCanvas" width="500" height="400"></canvas>
<script src="./index.ts"></script> <script src="./index.ts"></script>
</body></html> </body></html>

View file

@ -1 +1,2 @@
import "./Game/Main"; import "./Game/Main";
import "./Ecs/test";