floppy-venture/src/game/levels.ts

123 lines
4.6 KiB
TypeScript

import { CodeBlockContainer } from "../store/codeBlocks/types";
import { Voxel, BUTTON_ACTIONABLE } from "./voxel";
export interface LevelInitializer {
name: string;
voxels: Array<Voxel>;
playerPos: IPlayerData;
codeviews: Array<CodeBlockContainer>;
allowedCodeBlocks: Array<string>;
activeCodeview: string;
introMessages: Array<IIntroMessage> | null;
}
export interface IOperationsDict {
[key: string]: string[];
}
export interface ICodeview {
name: string;
nLines: number;
}
export interface IPlayerData {
voxelIdx: number;
direction: string;
}
export interface IIntroMessage {
message: string;
image: string | null;
}
export const levels: LevelInitializer[] = [
{
name: "tutorial",
voxels: [{ x: 0, y: 0, z: 0 },
{ x: 1, y: 0, z: 0 },
{ x: 2, y: 0, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } },
],
playerPos: { voxelIdx: 0, direction: "east" },
codeviews: [{
name: "main", nMaxBlocks: 3, blocks: [
{ name: "forward", containerIndex: 0 },
{ name: "forward", containerIndex: 0 },
{ name: "action", containerIndex: 0 }]
}],
activeCodeview: "main",
allowedCodeBlocks: ["forward", "turn_right", "turn_left", "jump", "action", "f1"],
introMessages: [{ message: "Hit run and watch.", image: null },
{ message: "second page of intro message", image: null }]
},
{
name: "hello world",
voxels: [{ x: 0, y: 0, z: 0 },
{ x: 1, y: 0, z: 0 },
{ x: 2, y: 0, z: 0 },
{ x: 3, y: 0, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } },
{ x: 3, y: 1, z: 0 },
{ x: 3, y: 2, z: 0 },
{ x: 3, y: 3, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } }],
playerPos: { voxelIdx: 0, direction: "east" },
codeviews: [{
name: "main",
nMaxBlocks: 3,
blocks: [{ name: "f1" }, { name: "turn_left" }]
},
{
name: "f1", nMaxBlocks: 4, blocks: [{ name: "forward" },
{ name: "forward" },
{ name: "forward" },
{ name: "action" }]
}],
activeCodeview: "main",
allowedCodeBlocks: ["forward", "turn_right", "turn_left", "jump", "action", "f1"],
introMessages: [{ message: "light up all dark cubes!", image: null }]
},
{
name: "jump n run",
voxels: [{ x: 0, y: 0, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } },
{ x: 0, y: 1, z: 1 },
{ x: 0, y: 2, z: 1 },
{ x: 0, y: 3, z: 0 },
{ x: 0, y: 4, z: 0 },
{ x: 0, y: 5, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } }],
playerPos: { voxelIdx: 0, direction: "north" },
codeviews: [{ name: "main", nMaxBlocks: 4, blocks: [] },
{ name: "f1", nMaxBlocks: 3, blocks: [] }],
activeCodeview: "main",
allowedCodeBlocks: ["forward", "turn_right", "turn_left", "jump", "action", "f1"],
introMessages: null
},
{
name: "jump n run 2",
voxels: [{ x: 0, y: 0, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } },
{ x: 0, y: 1, z: 1 },
{ x: 0, y: 2, z: 1 },
{ x: 1, y: 2, z: 0 },
{ x: 2, y: 2, z: 0 },
{ x: 3, y: 2, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } }],
playerPos: { voxelIdx: 0, direction: "north" },
codeviews: [{ name: "main", nMaxBlocks: 4, blocks: [] },
{ name: "f1", nMaxBlocks: 3, blocks: [] }],
activeCodeview: "main",
allowedCodeBlocks: ["forward", "turn_right", "turn_left", "jump", "action", "f1"],
introMessages: null
},
{
name: "jump n run 3",
voxels: [{ x: 0, y: 0, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } },
{ x: 0, y: 1, z: 1 },
{ x: 0, y: 2, z: 1 },
{ x: 0, y: 3, z: 0 },
{ x: 0, y: 4, z: 0 },
{ x: 0, y: 5, z: 0, actionable: { type: BUTTON_ACTIONABLE.type, pushed: BUTTON_ACTIONABLE.pushed } }],
playerPos: { voxelIdx: 0, direction: "north" },
codeviews: [{ name: "main", nMaxBlocks: 4, blocks: [] },
{ name: "f1", nMaxBlocks: 3, blocks: [] }],
activeCodeview: "main",
allowedCodeBlocks: ["forward", "turn_right", "turn_left", "jump", "action", "f1"],
introMessages: null
}
];