track drawing and shape tweaks, train controls, fps counter, non-looping

This commit is contained in:
2025-02-13 03:23:37 -07:00
parent e3194e45ff
commit 43a5268ed5
12 changed files with 631 additions and 128 deletions

View File

@@ -348,7 +348,6 @@ export class EditTrackState extends State<States> {
// });
inputManager.onNumberKey((i) => {
console.log(i);
const segments = getContextItem<TrackSegment[]>("trackSegments");
this.selectedSegment = segments[i];
this.ghostRotated = false;

View File

@@ -46,6 +46,24 @@ export class RunningState extends State<States> {
const train = new Train(track.path, [new RedEngine(), new Tender()]);
ctx.trains.push(train);
});
// const trainCount = 1000;
// for (let i = 0; i < trainCount; i++) {
// const train = new Train(track.path, [new RedEngine(), new Tender()]);
// ctx.trains.push(train);
// }
inputManager.onKey("ArrowUp", () => {
const trains = getContextItem<Train[]>("trains");
for (const train of trains) {
train.speed += 1;
}
});
inputManager.onKey("ArrowDown", () => {
const trains = getContextItem<Train[]>("trains");
for (const train of trains) {
train.speed -= 1;
}
});
}
override stop(): void {
// noop