fix: bugs in GameOver
This commit is contained in:
		
							parent
							
								
									17afceee47
								
							
						
					
					
						commit
						c5e40103a2
					
				| 
						 | 
					@ -359,7 +359,9 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
                            this.respawnPlayer();
 | 
					                            this.respawnPlayer();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else{ //no more lives
 | 
					                        else{ //no more lives
 | 
				
			||||||
 | 
					                            this.viewport.setZoomLevel(1);
 | 
				
			||||||
                            this.sceneManager.changeToScene(GameOver, {});
 | 
					                            this.sceneManager.changeToScene(GameOver, {});
 | 
				
			||||||
 | 
					                            InputWrapper.enableInput();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    case "startStory":
 | 
					                    case "startStory":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,10 @@
 | 
				
			||||||
import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
 | 
					import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
 | 
				
			||||||
import Input from "../../Wolfie2D/Input/Input";
 | 
					 | 
				
			||||||
import Label from "../../Wolfie2D/Nodes/UIElements/Label";
 | 
					import Label from "../../Wolfie2D/Nodes/UIElements/Label";
 | 
				
			||||||
import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
 | 
					import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
 | 
				
			||||||
import Scene from "../../Wolfie2D/Scene/Scene";
 | 
					import Scene from "../../Wolfie2D/Scene/Scene";
 | 
				
			||||||
import Color from "../../Wolfie2D/Utils/Color";
 | 
					import Color from "../../Wolfie2D/Utils/Color";
 | 
				
			||||||
 | 
					import InputWrapper from "../Tools/InputWrapper";
 | 
				
			||||||
 | 
					import MainMenu from "./MainMenu";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class GameOver extends Scene {
 | 
					export default class GameOver extends Scene {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +13,17 @@ export default class GameOver extends Scene {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.addUILayer("primary");
 | 
					        this.addUILayer("primary");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const gameOver = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y), text: "Game Over"});
 | 
					        const gameOver = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y), text: "YOU DIED"});
 | 
				
			||||||
        gameOver.textColor = Color.WHITE;
 | 
					        gameOver.textColor = Color.RED;
 | 
				
			||||||
 | 
					        gameOver.fontSize = 100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const hint = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y + 100), text: "Click to go back to Main Menu"});
 | 
				
			||||||
 | 
					        hint.textColor = Color.WHITE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    updateScene(){
 | 
				
			||||||
 | 
					        if(InputWrapper.isLeftMouseJustPressed()){
 | 
				
			||||||
 | 
					            this.sceneManager.changeToScene(MainMenu);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user