diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.json b/dist/shattered_sword_assets/spritesheets/Hiro.json new file mode 100644 index 0000000..f593278 --- /dev/null +++ b/dist/shattered_sword_assets/spritesheets/Hiro.json @@ -0,0 +1,27 @@ +{ + "name": "Hiro", + "spriteSheetImage": "Hiro.png", + "spriteWidth": 32, + "spriteHeight": 32, + "columns": 1, + "rows": 1, + "durationType": "time", + "animations": [ + { + "name": "IDLE", + "frames": [ {"index": 0, "duration": 540} ] + }, + { + "name": "JUMP", + "frames":[ {"index": 0, "duration": 32}] + }, + { + "name": "WALK", + "frames": [ {"index": 0, "duration": 540} ] + }, + { + "name": "FALL", + "frames": [ {"index": 0, "duration": 540} ] + } + ] +} \ No newline at end of file diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.png b/dist/shattered_sword_assets/spritesheets/Hiro.png new file mode 100644 index 0000000..729338f Binary files /dev/null and b/dist/shattered_sword_assets/spritesheets/Hiro.png differ diff --git a/dist/shattered_sword_assets/tilemaps/Tutorial.json b/dist/shattered_sword_assets/tilemaps/Tutorial.json new file mode 100644 index 0000000..c06c17a --- /dev/null +++ b/dist/shattered_sword_assets/tilemaps/Tutorial.json @@ -0,0 +1,59 @@ +{ "compressionlevel":-1, + "height":20, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 33, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 33, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 33, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 35, 41, 42, 42, 42, 42, 43, 0, 0, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 0, 0, 41, 34, 34, 34, 34, 43], + "height":20, + "id":1, + "name":"Main", + "opacity":1, + "properties":[ + { + "name":"Collidable", + "type":"bool", + "value":true + }], + "type":"tilelayer", + "visible":true, + "width":30, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":20, + "id":2, + "name":"Background", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":30, + "x":0, + "y":0 + }], + "nextlayerid":3, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.2", + "tileheight":16, + "tilesets":[ + { + "columns":8, + "firstgid":1, + "image":"forest_tileset.png", + "imageheight":128, + "imagewidth":128, + "margin":0, + "name":"forest_tileset", + "spacing":0, + "tilecount":64, + "tileheight":16, + "tilewidth":16 + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":30 +} \ No newline at end of file diff --git a/dist/shattered_sword_assets/tilemaps/bamboo_forest.tsx b/dist/shattered_sword_assets/tilemaps/bamboo_forest.tsx new file mode 100644 index 0000000..24c0ba2 --- /dev/null +++ b/dist/shattered_sword_assets/tilemaps/bamboo_forest.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/dist/shattered_sword_assets/tilemaps/forest1.json b/dist/shattered_sword_assets/tilemaps/forest1.json new file mode 100644 index 0000000..c88faa6 --- /dev/null +++ b/dist/shattered_sword_assets/tilemaps/forest1.json @@ -0,0 +1,107 @@ +{ "compressionlevel":-1, + "height":20, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 0, 0, 0, 0, 0, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, + 53, 54, 54, 54, 54, 54, 55, 0, 0, 33, 34, 34, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 0, 0, 53, 54, 54, 54, 54, 55, + 33, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 35, + 33, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 35, + 33, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 35, + 33, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 0, 0, 33, 34, 34, 34, 34, 35, + 41, 42, 42, 42, 42, 42, 43, 0, 0, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 0, 0, 41, 42, 42, 42, 42, 43], + "height":20, + "id":1, + "name":"Main", + "opacity":1, + "properties":[ + { + "name":"Collidable", + "type":"bool", + "value":true + }, + { + "name":"Depth", + "type":"int", + "value":1 + }, + { + "name":"Group", + "type":"string", + "value":"ground" + }], + "type":"tilelayer", + "visible":true, + "width":30, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":20, + "id":2, + "name":"Background ", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":30, + "x":0, + "y":0 + }], + "nextlayerid":6, + "nextobjectid":1, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.8.4", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "columns":8, + "image":"forest1.png", + "imageheight":128, + "imagewidth":128, + "margin":0, + "name":"forest1", + "spacing":0, + "tilecount":64, + "tileheight":16, + "tilewidth":16 + }], + "tilewidth":16, + "type":"map", + "version":"1.8", + "width":30 +} \ No newline at end of file diff --git a/dist/shattered_sword_assets/tilemaps/forest1.png b/dist/shattered_sword_assets/tilemaps/forest1.png new file mode 100644 index 0000000..946d870 Binary files /dev/null and b/dist/shattered_sword_assets/tilemaps/forest1.png differ diff --git a/dist/shattered_sword_assets/tilemaps/forest_tileset.png b/dist/shattered_sword_assets/tilemaps/forest_tileset.png new file mode 100644 index 0000000..49a2c8d Binary files /dev/null and b/dist/shattered_sword_assets/tilemaps/forest_tileset.png differ diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 87da100..0d88073 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -11,7 +11,10 @@ import Jump from "./PlayerStates/Jump"; import Walk from "./PlayerStates/Walk"; import Debug from "../../Wolfie2D/Debug/Debug"; - +export enum PlayerType { + PLATFORMER = "platformer", + TOPDOWN = "topdown" +} export enum PlayerStates { IDLE = "idle", diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index d275123..26651e9 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -72,8 +72,10 @@ export default class GameLevel extends Scene { // Start the black screen fade out this.levelTransitionScreen.tweens.play("fadeOut"); + //TODO - uncomment when done testing // Initially disable player movement - Input.disableInput(); + //Input.disableInput(); + Input.enableInput(); } @@ -150,6 +152,37 @@ export default class GameLevel extends Scene { ] }); + this.levelTransitionScreen = this.add.graphic(GraphicType.RECT, "UI", {position: new Vec2(300, 200), size: new Vec2(600, 400)}); + this.levelTransitionScreen.color = new Color(34, 32, 52); + this.levelTransitionScreen.alpha = 1; + + this.levelTransitionScreen.tweens.add("fadeIn", { + startDelay: 0, + duration: 1000, + effects: [ + { + property: TweenableProperties.alpha, + start: 0, + end: 1, + ease: EaseFunctionType.IN_OUT_QUAD + } + ], + onEnd: Player_Events.LEVEL_END + }); + + this.levelTransitionScreen.tweens.add("fadeOut", { + startDelay: 0, + duration: 1000, + effects: [ + { + property: TweenableProperties.alpha, + start: 1, + end: 0, + ease: EaseFunctionType.IN_OUT_QUAD + } + ], + onEnd: Player_Events.LEVEL_START + }); } diff --git a/src/shattered_sword/Scenes/Levels.ts b/src/shattered_sword/Scenes/Levels.ts index 9624890..003d001 100644 --- a/src/shattered_sword/Scenes/Levels.ts +++ b/src/shattered_sword/Scenes/Levels.ts @@ -12,6 +12,7 @@ import Layer from "../../Wolfie2D/Scene/Layer"; import Label from "../../Wolfie2D/Nodes/UIElements/Label"; import MainMenu from "./MainMenu"; import SceneWithStory from "./SceneWithStory"; +import Tutorial from "./Tutorial"; export default class Levels extends Scene { @@ -25,6 +26,13 @@ export default class Levels extends Scene { this.primary = this.addUILayer("primary"); + const tutorial = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y - 200), text: "tutorial "}); + tutorial.size.set(200, 50); + tutorial.borderWidth = 2; + tutorial.borderColor = Color.WHITE; + tutorial.backgroundColor = Color.TRANSPARENT; + tutorial.onClickEventId = "tutorial"; + const level1 = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y - 150), text: "level 1"}); level1.size.set(200, 50); level1.borderWidth = 2; @@ -74,6 +82,7 @@ export default class Levels extends Scene { back.backgroundColor = Color.TRANSPARENT; back.onClickEventId = "back"; + this.receiver.subscribe("tutorial"); this.receiver.subscribe("level1"); this.receiver.subscribe("level2"); this.receiver.subscribe("level3"); @@ -89,6 +98,11 @@ export default class Levels extends Scene { console.log(event); + + if(event.type === "tutorial"){ + this.sceneManager.changeToScene(Tutorial, {}); + } + if(event.type === "level1"){ this.sceneManager.changeToScene(MainMenu, {}); } diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -0,0 +1,33 @@ +import Vec2 from "../../Wolfie2D/DataTypes/Vec2"; +import Debug from "../../Wolfie2D/Debug/Debug"; +import { GameEventType } from "../../Wolfie2D/Events/GameEventType"; +import GameLevel from "./GameLevel"; + + + +export default class Tutorial extends GameLevel{ + + loadScene(): void { + // Load resources + this.load.tilemap("forest1", "shattered_sword_assets/tilemaps/Tutorial.json"); + this.load.spritesheet("player", "shattered_sword_assets/spritesheets/Hiro.json") + //load music here + } + + startScene(): void { + // Add the level 1 tilemap + this.add.tilemap("forest1", new Vec2(2, 2)); + this.viewport.setBounds(0, 0, 64*32, 20*32); + + this.playerSpawn = new Vec2(5*32, 9*32); + + // Do generic setup for a GameLevel + super.startScene(); + + } + + updateScene(deltaT: number): void { + super.updateScene(deltaT); + } + +} \ No newline at end of file