Skip to content

Commit

Permalink
Create main menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
voithos committed Jul 17, 2022
1 parent 9a5678f commit 200236e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
Binary file added assets/ui/startscreen.aseprite
Binary file not shown.
Binary file added assets/ui/startscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/ui/startscreen.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/startscreen.png-d7a6273392897ce5197005cc2ccf9315.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/ui/startscreen.png"
dest_files=[ "res://.import/startscreen.png-d7a6273392897ce5197005cc2ccf9315.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _global_script_class_icons={
[application]

config/name="Coloroid"
run/main_scene="res://scenes/levels/main.tscn"
run/main_scene="res://scenes/main_menu.tscn"
config/icon="res://icon.png"

[autoload]
Expand Down
13 changes: 13 additions & 0 deletions scenes/main_menu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends Node2D

func _ready():
music.play(music.BACKGROUND)

func _input(event):
if Input.is_action_just_pressed("jump"):
var transition = get_tree().get_nodes_in_group("transition")[0]
transition.connect("fade_complete", self, "_load_main_level")
transition.begin_fade()

func _load_main_level():
get_tree().change_scene("res://scenes/levels/main.tscn")
16 changes: 16 additions & 0 deletions scenes/main_menu.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://scenes/transition.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/ui/startscreen.png" type="Texture" id=2]
[ext_resource path="res://scenes/main_menu.gd" type="Script" id=3]

[node name="main_menu" type="Node2D"]
script = ExtResource( 3 )

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="Startscreen" type="Sprite" parent="CanvasLayer"]
position = Vector2( 160, 90 )
texture = ExtResource( 2 )

[node name="transition" parent="." instance=ExtResource( 1 )]

0 comments on commit 200236e

Please sign in to comment.