add snow mountain level tilemap
This commit is contained in:
		
							parent
							
								
									bcdafb1625
								
							
						
					
					
						commit
						e26f011fee
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -41,6 +41,7 @@ import GameOver from "./GameOver";
 | 
				
			||||||
import Porcelain from "./Porcelain";
 | 
					import Porcelain from "./Porcelain";
 | 
				
			||||||
import Tutorial from "./Tutorial";
 | 
					import Tutorial from "./Tutorial";
 | 
				
			||||||
import Greatwall from "./Greatwall";
 | 
					import Greatwall from "./Greatwall";
 | 
				
			||||||
 | 
					import Snow from "./Snow";
 | 
				
			||||||
import MainMenu from "./MainMenu";
 | 
					import MainMenu from "./MainMenu";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//  TODO
 | 
					//  TODO
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@ import MainMenu from "./MainMenu";
 | 
				
			||||||
import Tutorial from "./Tutorial";
 | 
					import Tutorial from "./Tutorial";
 | 
				
			||||||
import Porcelain from "./Porcelain";
 | 
					import Porcelain from "./Porcelain";
 | 
				
			||||||
import Greatwall from './Greatwall';
 | 
					import Greatwall from './Greatwall';
 | 
				
			||||||
 | 
					import Snow from './Snow';
 | 
				
			||||||
import InputWrapper from "../Tools/InputWrapper";
 | 
					import InputWrapper from "../Tools/InputWrapper";
 | 
				
			||||||
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
 | 
					import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,7 +58,14 @@ export default class Levels extends Scene {
 | 
				
			||||||
        greatwall.backgroundColor = Color.TRANSPARENT;
 | 
					        greatwall.backgroundColor = Color.TRANSPARENT;
 | 
				
			||||||
        greatwall.onClickEventId = "greatwall";
 | 
					        greatwall.onClickEventId = "greatwall";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const back = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 200), text: "Back"});
 | 
					        const snow = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 200), text: "snow(Test)"});
 | 
				
			||||||
 | 
					        snow.size.set(200, 50);
 | 
				
			||||||
 | 
					        snow.borderWidth = 2;
 | 
				
			||||||
 | 
					        snow.borderColor = Color.WHITE;
 | 
				
			||||||
 | 
					        snow.backgroundColor = Color.TRANSPARENT;
 | 
				
			||||||
 | 
					        snow.onClickEventId = "snow";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const back = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 300), text: "Back"});
 | 
				
			||||||
        back.size.set(200, 50);
 | 
					        back.size.set(200, 50);
 | 
				
			||||||
        back.borderWidth = 2;
 | 
					        back.borderWidth = 2;
 | 
				
			||||||
        back.borderColor = Color.WHITE;
 | 
					        back.borderColor = Color.WHITE;
 | 
				
			||||||
| 
						 | 
					@ -67,6 +75,7 @@ export default class Levels extends Scene {
 | 
				
			||||||
        this.receiver.subscribe("start");
 | 
					        this.receiver.subscribe("start");
 | 
				
			||||||
        this.receiver.subscribe("porcelain");
 | 
					        this.receiver.subscribe("porcelain");
 | 
				
			||||||
        this.receiver.subscribe("greatwall");
 | 
					        this.receiver.subscribe("greatwall");
 | 
				
			||||||
 | 
					        this.receiver.subscribe("snow");
 | 
				
			||||||
        this.receiver.subscribe("back");
 | 
					        this.receiver.subscribe("back");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -129,6 +138,21 @@ export default class Levels extends Scene {
 | 
				
			||||||
                this.sceneManager.changeToScene(Greatwall, {}, sceneOptions);
 | 
					                this.sceneManager.changeToScene(Greatwall, {}, sceneOptions);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(event.type === "snow"){
 | 
				
			||||||
 | 
					                let sceneOptions = {
 | 
				
			||||||
 | 
					                    physics: {
 | 
				
			||||||
 | 
					                        groupNames: ["ground", "player", "enemies"],
 | 
				
			||||||
 | 
					                        collisions:
 | 
				
			||||||
 | 
					                        [
 | 
				
			||||||
 | 
					                            [0, 1, 1],
 | 
				
			||||||
 | 
					                            [1, 0, 0],
 | 
				
			||||||
 | 
					                            [1, 0, 0]
 | 
				
			||||||
 | 
					                        ]
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                this.sceneManager.changeToScene(Snow, {}, sceneOptions);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(event.type === "back"){
 | 
					            if(event.type === "back"){
 | 
				
			||||||
                this.sceneManager.changeToScene(MainMenu, {});
 | 
					                this.sceneManager.changeToScene(MainMenu, {});
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										32
									
								
								src/shattered_sword/Scenes/Snow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/shattered_sword/Scenes/Snow.ts
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData";
 | 
				
			||||||
 | 
					import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
 | 
				
			||||||
 | 
					import Debug from "../../Wolfie2D/Debug/Debug";
 | 
				
			||||||
 | 
					import { GameEventType } from "../../Wolfie2D/Events/GameEventType";
 | 
				
			||||||
 | 
					import RandomMapGenerator from "../Tools/RandomMapGenerator";
 | 
				
			||||||
 | 
					import GameLevel from "./GameLevel";
 | 
				
			||||||
 | 
					import Label from "../../Wolfie2D/Nodes/UIElements/Label";
 | 
				
			||||||
 | 
					import Color from "../../Wolfie2D/Utils/Color";
 | 
				
			||||||
 | 
					import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
 | 
				
			||||||
 | 
					import { Statuses } from "../sword_enums";
 | 
				
			||||||
 | 
					import AABB from "../../Wolfie2D/DataTypes/Shapes/AABB";
 | 
				
			||||||
 | 
					import EnemyAI from "../AI/EnemyAI";
 | 
				
			||||||
 | 
					import BattlerAI from "../AI/BattlerAI";
 | 
				
			||||||
 | 
					import InputWrapper from "../Tools/InputWrapper";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default class Snow extends GameLevel {
 | 
				
			||||||
 | 
					    loadScene(): void {
 | 
				
			||||||
 | 
					        super.loadScene();
 | 
				
			||||||
 | 
					        this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/snow_template.json", InputWrapper.randomSeed);
 | 
				
			||||||
 | 
					        this.map = this.rmg.getMap();
 | 
				
			||||||
 | 
					        console.log(this.map);
 | 
				
			||||||
 | 
					        this.load.tilemapFromObject("map", this.map);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //load enemies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //can load enemy sprite here
 | 
				
			||||||
 | 
					        //sprites obtained from cse380 sprite wesbite
 | 
				
			||||||
 | 
					        // this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //load music here
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user