feat: implement goToNextLevel(very buggy)
This commit is contained in:
		
							parent
							
								
									797d571b76
								
							
						
					
					
						commit
						5277697af6
					
				| 
						 | 
					@ -39,6 +39,8 @@ import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData";
 | 
				
			||||||
import AttackAction from "../AI/EnemyActions/AttackAction";
 | 
					import AttackAction from "../AI/EnemyActions/AttackAction";
 | 
				
			||||||
import Move from "../AI/EnemyActions/Move";
 | 
					import Move from "../AI/EnemyActions/Move";
 | 
				
			||||||
import GameOver from "./GameOver";
 | 
					import GameOver from "./GameOver";
 | 
				
			||||||
 | 
					import Porcelain from "./Porcelain";
 | 
				
			||||||
 | 
					import Tutorial from "./Tutorial";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//  TODO
 | 
					//  TODO
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -136,6 +138,7 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
    protected static gameTimer: number = 0;
 | 
					    protected static gameTimer: number = 0;
 | 
				
			||||||
    protected gameStarted: boolean = false;
 | 
					    protected gameStarted: boolean = false;
 | 
				
			||||||
    protected timerLable: Label;
 | 
					    protected timerLable: Label;
 | 
				
			||||||
 | 
					    protected levelEnded: boolean = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    startpos: Vec2; 
 | 
					    startpos: Vec2; 
 | 
				
			||||||
    loadScene(): void {
 | 
					    loadScene(): void {
 | 
				
			||||||
| 
						 | 
					@ -1072,6 +1075,7 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
            this.touchedStartCheckPoint = true;
 | 
					            this.touchedStartCheckPoint = true;
 | 
				
			||||||
            this.storyLoader("shattered_sword_assets/jsons/story.json");
 | 
					            this.storyLoader("shattered_sword_assets/jsons/story.json");
 | 
				
			||||||
            this.startTimer();
 | 
					            this.startTimer();
 | 
				
			||||||
 | 
					            this.levelEnded = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1080,6 +1084,7 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
            this.touchedEndCheckPoint = true;
 | 
					            this.touchedEndCheckPoint = true;
 | 
				
			||||||
            this.storyLoader("shattered_sword_assets/jsons/story.json");
 | 
					            this.storyLoader("shattered_sword_assets/jsons/story.json");
 | 
				
			||||||
            this.endTimer();
 | 
					            this.endTimer();
 | 
				
			||||||
 | 
					            this.levelEnded = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1092,7 +1097,7 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected goToNextLevel() {
 | 
					    protected goToNextLevel() {
 | 
				
			||||||
        console.log("goToNextLevel")
 | 
					        // this.sceneManager.changeToScene(Porcelain);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1210,6 +1215,9 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
            this.story = undefined;
 | 
					            this.story = undefined;
 | 
				
			||||||
            this.storytextLabel = undefined;
 | 
					            this.storytextLabel = undefined;
 | 
				
			||||||
            // this.storyLayer = undefined;
 | 
					            // this.storyLayer = undefined;
 | 
				
			||||||
 | 
					            if (this.levelEnded) {
 | 
				
			||||||
 | 
					                this.goToNextLevel();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,9 +21,6 @@ export default class MainMenu extends Scene {
 | 
				
			||||||
    private about: Layer;
 | 
					    private about: Layer;
 | 
				
			||||||
    private control: Layer;
 | 
					    private control: Layer;
 | 
				
			||||||
    // private rmg: RandomMapGenerator;
 | 
					    // private rmg: RandomMapGenerator;
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    animatedSprite: AnimatedSprite;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    loadScene(): void {
 | 
					    loadScene(): void {
 | 
				
			||||||
        // Load the menu song
 | 
					        // Load the menu song
 | 
				
			||||||
| 
						 | 
					@ -33,24 +30,6 @@ export default class MainMenu extends Scene {
 | 
				
			||||||
    //TODO 
 | 
					    //TODO 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    startScene(): void{
 | 
					    startScene(): void{
 | 
				
			||||||
        // this.config = new ConfigManager();
 | 
					 | 
				
			||||||
        // this.save = new SaveManager();
 | 
					 | 
				
			||||||
        // console.log(this.config.getVolume());
 | 
					 | 
				
			||||||
        // this.config.setVolume(100);
 | 
					 | 
				
			||||||
        // console.log(this.config.getVolume());
 | 
					 | 
				
			||||||
        // console.log(this.save.getLevel());
 | 
					 | 
				
			||||||
        // this.save.setLevel(10);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // console.log(this.save.getLevel());
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        // this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/forest_template.json", 114514);
 | 
					 | 
				
			||||||
        // this.rmg.getMap();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Scene has started, so start playing music
 | 
					 | 
				
			||||||
        //this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "menu", loop: true, holdReference: true});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        const center = this.viewport.getCenter();
 | 
					        const center = this.viewport.getCenter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // The main menu
 | 
					        // The main menu
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,8 @@ import EnemyAI from "../AI/EnemyAI";
 | 
				
			||||||
import BattlerAI from "../AI/BattlerAI";
 | 
					import BattlerAI from "../AI/BattlerAI";
 | 
				
			||||||
import AttackAction from "../AI/EnemyActions/AttackAction";
 | 
					import AttackAction from "../AI/EnemyActions/AttackAction";
 | 
				
			||||||
import Move from "../AI/EnemyActions/Move";
 | 
					import Move from "../AI/EnemyActions/Move";
 | 
				
			||||||
 | 
					import Porcelain from "./Porcelain";
 | 
				
			||||||
 | 
					import MainMenu from "./MainMenu";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class Tutorial extends GameLevel {
 | 
					export default class Tutorial extends GameLevel {
 | 
				
			||||||
    loadScene(): void {
 | 
					    loadScene(): void {
 | 
				
			||||||
| 
						 | 
					@ -54,4 +56,8 @@ export default class Tutorial extends GameLevel {
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected goToNextLevel(): void {
 | 
				
			||||||
 | 
					        this.sceneManager.changeToScene(MainMenu);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user