Var next_level_resource = load("res://Scenes/Main.tscn") Get_tree().change_scene("res://Scenes/Main.tscn") If Input.is_action_just_pressed("ui_down"):Įlif Input.is_action_just_pressed("ui_up"):Įlif Input.is_action_just_pressed("attack"): Copy this code inside the script: extends Node2D You’ll end up with this node structure for the StartScreen scene:Īttach a new script to the StartScreen node, call it StartScreen.gd and save it in the GUI folder. Enable the Autoplay property to play music when the game starts. Add an AudioStreamPlayer node to StartScreen and in the Stream property load the night-chip.ogg file (you can find it in the Sounds folder). ![]() Finally, change its label’s text to QUIT.įinally, let’s add some background music to our menu. Select the Quit node and set its Rect → Position to (70, 110). Set LoadGame‘s Rect → Position to (70, 80), then change its label’s text to LOAD GAME. Rename one copy to LoadGame and the other to Quit. Finally, set the Rect → Size of the label to (180, 20). Write NEW GAME in the Text property of the label, then set both Align and Valign to Center. In the Custom Fonts property load es (you’ll find it in the Fonts folder) and in Custom Colors set Font Color to black. Set Rect → Position to (70, 50) and Rect → Size to (180, 20). Now, add another ColorRect to StartScreen and rename it NewGame. ![]() Change its Color property to black (0,0,0,255). Rename it StartScreen.Īdd a ColorRect node to StartScreen and resize it to 320×180 pixels: it will be our menu background. Then, in the Scene panel, click the 2D Scene button to create a Node2D root node. To start, let’s create a new scene for the start menu by clicking on Scene → New Scene. Graphically, it’s a very basic menu – feel free to add your game logo and any graphics you want.
0 Comments
Leave a Reply. |