diff options
Diffstat (limited to 'src/engine/levels')
-rw-r--r-- | src/engine/levels/Tutorial.ts | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/engine/levels/Tutorial.ts b/src/engine/levels/Tutorial.ts index b720346..a8ba8d0 100644 --- a/src/engine/levels/Tutorial.ts +++ b/src/engine/levels/Tutorial.ts @@ -3,21 +3,49 @@ import { Game } from ".."; import { Curry, FunctionApplication, + Grass, LambdaFactory, LockedDoor, Player, Sign, Wall, } from "../entities"; +import { Grid, SystemNames } from "../systems"; +import { normalRandom } from "../utils"; export class Tutorial extends Level { constructor() { super(LevelNames.Tutorial); } - public init(game: Game): void { + public init(game: Game) { + const grid = game.getSystem<Grid>(SystemNames.Grid); + const dimensions = grid.getGridDimensions(); + + const grasses = Array.from({ length: dimensions.width }) + .fill(0) + .map(() => { + // random grass + return new Grass({ + x: Math.floor( + normalRandom(dimensions.width / 2, dimensions.width / 4, 1.5), + ), + y: Math.floor( + normalRandom(dimensions.height / 2, dimensions.height / 4, 1.5), + ), + }); + }); + const entities = [ - new Sign("TODO: Explain entities", { x: 4, y: 3 }), + ...grasses, + new Sign( + "this is a Lambda Factory<br><br>modify the produced term by interacting from the top or bottom ↕️<br><br>then produce the term by pressing the button on the left or right ↔️<br><br>", + { x: 4, y: 3 }, + ), + new Sign( + "this is a Term Application; interact to view its code<br><br>push the term ➡️ created by the factory any direction into the Application to produce a new one 💭<br><br>. _INPUT is the term replaced by the pushed term<br><br>. in this case _KEY is applied to the function to make a new KEY! 🔑", + { x: 4, y: 6 }, + ), new Wall({ x: 10, y: 9 }), new Wall({ x: 10, y: 11 }), new Wall({ x: 11, y: 10 }), |