feat: proto Input Menu, Savefile mit Resource erstellt
This commit is contained in:
parent
17996edf36
commit
ec5c67930c
BIN
assets/environment/blocks/basic_tileset_blobb-jakob-remix.png
Normal file
BIN
assets/environment/blocks/basic_tileset_blobb-jakob-remix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/basic_tileset_blobb-jakob-remix.png-13582a1ad77f1898911d8c065e575215.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/environment/blocks/basic_tileset_blobb-jakob-remix.png"
|
||||
dest_files=[ "res://.import/basic_tileset_blobb-jakob-remix.png-13582a1ad77f1898911d8c065e575215.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=false
|
||||
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
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
BIN
assets/ui/Screenshot 2023-05-23 160521.png
Normal file
BIN
assets/ui/Screenshot 2023-05-23 160521.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/galletcity_tiles.png-9e378740b558af86060a286a7fa827d0.stex"
|
||||
path="res://.import/Screenshot 2023-05-23 160521.png-6de2cfec0cf07091a47ad2ca582bc327.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/environment/galletcity_tiles.png"
|
||||
dest_files=[ "res://.import/galletcity_tiles.png-9e378740b558af86060a286a7fa827d0.stex" ]
|
||||
source_file="res://assets/ui/Screenshot 2023-05-23 160521.png"
|
||||
dest_files=[ "res://.import/Screenshot 2023-05-23 160521.png-6de2cfec0cf07091a47ad2ca582bc327.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@ -19,6 +19,11 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://src/Actors/Enemies/Beings/Enemy.gd"
|
||||
}, {
|
||||
"base": "Resource",
|
||||
"class": "GlobalStateResource",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/Utilities/GlobalStateResource.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "LevelTemplate",
|
||||
"language": "GDScript",
|
||||
@ -42,6 +47,7 @@ _global_script_classes=[ {
|
||||
_global_script_class_icons={
|
||||
"Actor": "",
|
||||
"Enemy": "",
|
||||
"GlobalStateResource": "",
|
||||
"LevelTemplate": "",
|
||||
"RayCastDebugLines": "",
|
||||
"RayCaster": "",
|
||||
@ -57,6 +63,7 @@ config/icon="res://icon.png"
|
||||
[autoload]
|
||||
|
||||
GlobalState="*res://src/Autoload/GlobalState.tscn"
|
||||
SaveManager="*res://src/Autoload/SaveManager.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
@ -69,7 +76,7 @@ window/size/height=360
|
||||
window/size/test_width=1920
|
||||
window/size/test_height=1080
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
@ -115,7 +122,6 @@ ogg_vorbis={
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
|
||||
187
savefile.tres
Normal file
187
savefile.tres
Normal file
@ -0,0 +1,187 @@
|
||||
[gd_resource type="Resource" load_steps=50 format=2]
|
||||
|
||||
[ext_resource path="res://src/Utilities/GlobalStateResource.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="InputEventKey" id=1]
|
||||
scancode = 16777237
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=2]
|
||||
button_index = 1
|
||||
|
||||
[sub_resource type="InputEventMouseButton" id=3]
|
||||
button_index = 1
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=4]
|
||||
button_index = 13
|
||||
|
||||
[sub_resource type="InputEventJoypadMotion" id=5]
|
||||
axis = 1
|
||||
axis_value = 1.0
|
||||
|
||||
[sub_resource type="InputEventKey" id=6]
|
||||
physical_scancode = 83
|
||||
|
||||
[sub_resource type="InputEventKey" id=7]
|
||||
physical_scancode = 16777234
|
||||
|
||||
[sub_resource type="InputEventKey" id=8]
|
||||
physical_scancode = 69
|
||||
|
||||
[sub_resource type="InputEventKey" id=9]
|
||||
physical_scancode = 16777221
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=10]
|
||||
button_index = 2
|
||||
|
||||
[sub_resource type="InputEventKey" id=11]
|
||||
scancode = 32
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=12]
|
||||
|
||||
[sub_resource type="InputEventKey" id=13]
|
||||
physical_scancode = 16777232
|
||||
|
||||
[sub_resource type="InputEventJoypadMotion" id=14]
|
||||
axis_value = -1.0
|
||||
|
||||
[sub_resource type="InputEventKey" id=15]
|
||||
scancode = 65
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=16]
|
||||
device = -1
|
||||
button_index = 14
|
||||
|
||||
[sub_resource type="InputEventKey" id=17]
|
||||
physical_scancode = 16777231
|
||||
|
||||
[sub_resource type="InputEventKey" id=18]
|
||||
scancode = 68
|
||||
|
||||
[sub_resource type="InputEventJoypadMotion" id=19]
|
||||
axis_value = 1.0
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=20]
|
||||
device = -1
|
||||
button_index = 15
|
||||
|
||||
[sub_resource type="InputEventKey" id=21]
|
||||
physical_scancode = 16777233
|
||||
|
||||
[sub_resource type="InputEventKey" id=22]
|
||||
scancode = 16777217
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=23]
|
||||
button_index = 11
|
||||
|
||||
[sub_resource type="InputEventKey" id=24]
|
||||
scancode = 16777221
|
||||
|
||||
[sub_resource type="InputEventKey" id=25]
|
||||
scancode = 32
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=26]
|
||||
|
||||
[sub_resource type="InputEventKey" id=27]
|
||||
scancode = 16777217
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=28]
|
||||
button_index = 1
|
||||
|
||||
[sub_resource type="InputEventKey" id=29]
|
||||
scancode = 16777234
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=30]
|
||||
button_index = 13
|
||||
|
||||
[sub_resource type="InputEventKey" id=31]
|
||||
scancode = 16777230
|
||||
|
||||
[sub_resource type="InputEventKey" id=32]
|
||||
scancode = 16777218
|
||||
|
||||
[sub_resource type="InputEventKey" id=33]
|
||||
shift = true
|
||||
scancode = 16777218
|
||||
|
||||
[sub_resource type="InputEventKey" id=34]
|
||||
scancode = 16777229
|
||||
|
||||
[sub_resource type="InputEventKey" id=35]
|
||||
scancode = 16777231
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=36]
|
||||
button_index = 14
|
||||
|
||||
[sub_resource type="InputEventKey" id=37]
|
||||
scancode = 16777236
|
||||
|
||||
[sub_resource type="InputEventKey" id=38]
|
||||
scancode = 16777235
|
||||
|
||||
[sub_resource type="InputEventKey" id=39]
|
||||
scancode = 16777233
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=40]
|
||||
button_index = 15
|
||||
|
||||
[sub_resource type="InputEventKey" id=41]
|
||||
scancode = 32
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=42]
|
||||
button_index = 3
|
||||
|
||||
[sub_resource type="InputEventKey" id=43]
|
||||
scancode = 16777232
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=44]
|
||||
button_index = 12
|
||||
|
||||
[sub_resource type="InputEventKey" id=45]
|
||||
physical_scancode = 87
|
||||
|
||||
[sub_resource type="InputEventKey" id=46]
|
||||
physical_scancode = 16777232
|
||||
|
||||
[sub_resource type="InputEventJoypadMotion" id=47]
|
||||
axis = 1
|
||||
axis_value = -1.0
|
||||
|
||||
[sub_resource type="InputEventJoypadButton" id=48]
|
||||
button_index = 12
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
progress_dict = {
|
||||
"Level 1": {
|
||||
"currency": 0,
|
||||
"deaths": 0,
|
||||
"frees": 0,
|
||||
"kills": 0
|
||||
}
|
||||
}
|
||||
wallet = 0
|
||||
input_map = {
|
||||
"boost_move": [ SubResource( 1 ), SubResource( 2 ) ],
|
||||
"click": [ SubResource( 3 ) ],
|
||||
"duck": [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
|
||||
"interact": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ],
|
||||
"jump": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
|
||||
"move_left": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ) ],
|
||||
"move_right": [ SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ) ],
|
||||
"pause": [ SubResource( 22 ), SubResource( 23 ) ],
|
||||
"ui_accept": [ SubResource( 24 ), SubResource( 25 ), SubResource( 26 ) ],
|
||||
"ui_cancel": [ SubResource( 27 ), SubResource( 28 ) ],
|
||||
"ui_down": [ SubResource( 29 ), SubResource( 30 ) ],
|
||||
"ui_end": [ SubResource( 31 ) ],
|
||||
"ui_focus_next": [ SubResource( 32 ) ],
|
||||
"ui_focus_prev": [ SubResource( 33 ) ],
|
||||
"ui_home": [ SubResource( 34 ) ],
|
||||
"ui_left": [ SubResource( 35 ), SubResource( 36 ) ],
|
||||
"ui_page_down": [ SubResource( 37 ) ],
|
||||
"ui_page_up": [ SubResource( 38 ) ],
|
||||
"ui_right": [ SubResource( 39 ), SubResource( 40 ) ],
|
||||
"ui_select": [ SubResource( 41 ), SubResource( 42 ) ],
|
||||
"ui_up": [ SubResource( 43 ), SubResource( 44 ) ],
|
||||
"up": [ SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ) ]
|
||||
}
|
||||
show_tutorial = false
|
||||
@ -3,8 +3,8 @@ class_name Actor
|
||||
|
||||
#TODO Split the blobby specific parts up from this
|
||||
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
|
||||
|
||||
|
||||
@ -980,10 +980,10 @@ texture = ExtResource( 8 )
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||
visible = false
|
||||
frames = SubResource( 7 )
|
||||
frame = 1
|
||||
frame = 13
|
||||
playing = true
|
||||
|
||||
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||
frames = SubResource( 8 )
|
||||
frame = 6
|
||||
frame = 4
|
||||
playing = true
|
||||
|
||||
@ -3,8 +3,8 @@ extends Node2D
|
||||
# Is given in blocks
|
||||
export var movement_radius = 6
|
||||
onready var tilemap: TileMap = $"%TileMap"
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
var Rope = preload("res://src/Contraptions/Rope/Rope.tscn")
|
||||
var RopeAnchor = preload("res://src/Contraptions/Rope/RopeAnchor.tscn")
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
extends Node
|
||||
|
||||
var progress_dict := {} setget set_progress, get_progress
|
||||
var wallet := 0 setget set_wallet
|
||||
|
||||
func set_progress(value) -> void:
|
||||
progress_dict = value
|
||||
|
||||
func get_progress() -> Dictionary:
|
||||
return progress_dict
|
||||
|
||||
func set_savepoint(levelName: String, position: Vector2) -> void:
|
||||
if(!progress_dict.has(levelName)):
|
||||
progress_dict[levelName] = {}
|
||||
progress_dict[levelName]["savepoint"] = position
|
||||
|
||||
func get_property_value(levelName: String, propertyName: String) -> int:
|
||||
if progress_dict.has(levelName) && progress_dict[levelName].has(propertyName):
|
||||
return progress_dict[levelName][propertyName]
|
||||
else:
|
||||
return 0
|
||||
|
||||
func get_savepoint(levelName: String) -> Vector2:
|
||||
if progress_dict.has(levelName) && progress_dict[levelName].has("savepoint"):
|
||||
return progress_dict[levelName]["savepoint"]
|
||||
else:
|
||||
return Vector2()
|
||||
|
||||
func set_wallet(value) -> void:
|
||||
wallet = value
|
||||
@ -1,6 +1,17 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/Autoload/GlobalState.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/Utilities/GlobalState.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/Utilities/GlobalStateResource.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="Resource" id=1]
|
||||
script = ExtResource( 2 )
|
||||
progress_dict = {
|
||||
}
|
||||
wallet = 0
|
||||
input_map = {
|
||||
}
|
||||
show_tutorial = false
|
||||
|
||||
[node name="GlobalState" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
gsr = SubResource( 1 )
|
||||
|
||||
6
src/Autoload/InputMapLoader.tscn
Normal file
6
src/Autoload/InputMapLoader.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/Utilities/InputMapLoader.gd" type="Script" id=1]
|
||||
|
||||
[node name="InputMapLoader" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
19
src/Autoload/SaveManager.gd
Normal file
19
src/Autoload/SaveManager.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Node
|
||||
|
||||
export var save_location: String = "res://savefile.tres"
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
func _ready() -> void:
|
||||
load_initial_save()
|
||||
|
||||
func load_initial_save() -> void:
|
||||
var initial_state = load(save_location)
|
||||
if !initial_state:
|
||||
initial_state = GlobalStateResource.new()
|
||||
GlobalState.gsr = initial_state
|
||||
GlobalState.reinstate()
|
||||
|
||||
func save_default() -> void:
|
||||
for action in InputMap.get_actions():
|
||||
GlobalState.gsr.input_map[action] = InputMap.get_action_list(action)
|
||||
ResourceSaver.save(save_location, GlobalState.gsr)
|
||||
6
src/Autoload/SaveManager.tscn
Normal file
6
src/Autoload/SaveManager.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/Autoload/SaveManager.gd" type="Script" id=1]
|
||||
|
||||
[node name="SaveManager" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
@ -1,6 +1,6 @@
|
||||
extends Node2D
|
||||
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
|
||||
func _ready() -> void:
|
||||
if(GlobalState.get_savepoint(levelState.levelName) == global_position + Vector2(0,18)):
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
extends StaticBody2D
|
||||
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
|
||||
export var locked := true
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ tool
|
||||
extends Area2D
|
||||
|
||||
onready var anim_player: AnimationPlayer = $AnimationPlayer
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
onready var levelName := get_tree().get_current_scene().get_name()
|
||||
|
||||
export(String, FILE, "*.tscn") var next_scene
|
||||
|
||||
@ -4,7 +4,7 @@ onready var buttonPlayer = $"%ButtonPlayer"
|
||||
onready var activatorArea = $"%ActivatorArea"
|
||||
onready var indicatorPlayer = $"%IndicatorPlayer"
|
||||
onready var elevator = get_node("./Portal")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
onready var unactivatable_timer := $Timer
|
||||
onready var get_back_timer := $GetBackTimer
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
extends Node2D
|
||||
|
||||
onready var activatorArea = $"%ActivatorArea"
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var blobby := $"../%Blobby"
|
||||
onready var unactivatable_timer := $Timer
|
||||
export var cost := 3
|
||||
|
||||
29
src/Environment/Tileset.tres
Normal file
29
src/Environment/Tileset.tres
Normal file
@ -0,0 +1,29 @@
|
||||
[gd_resource type="TileSet" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/environment/blocks/GreenhouseInner.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=5]
|
||||
points = PoolVector2Array( 0, 24, 24, 24, 24, 0, 0, 0 )
|
||||
|
||||
[resource]
|
||||
0/name = "GreenhouseInner.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 24, 24 )
|
||||
0/tile_mode = 0
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape = SubResource( 5 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 1.0
|
||||
0/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 5 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
0/z_index = 0
|
||||
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=15 format=2]
|
||||
|
||||
[ext_resource path="res://src/Utilities/LevelState.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/UserInterface/UserInterface.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/Actors/BlobbyCam.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/Environment/AlienShipTileSet.tres" type="TileSet" id=5]
|
||||
[ext_resource path="res://assets/environment/blocks/basic_tileset_blobb-jakob-remix.png" type="Texture" id=6]
|
||||
[ext_resource path="res://src/Environment/ShaderGrass.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://src/Actors/Blobby/Blobby.tscn" type="PackedScene" id=9]
|
||||
@ -12,6 +13,74 @@
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachinePlayback" id=4]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=12]
|
||||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=13]
|
||||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
|
||||
|
||||
[sub_resource type="TileSet" id=11]
|
||||
0/name = "basic_tileset_blobb-jakob-remix.png 0"
|
||||
0/texture = ExtResource( 6 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 16, 0, 16, 16 )
|
||||
0/tile_mode = 1
|
||||
0/autotile/bitmask_mode = 0
|
||||
0/autotile/bitmask_flags = [ ]
|
||||
0/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
0/autotile/tile_size = Vector2( 16, 16 )
|
||||
0/autotile/spacing = 0
|
||||
0/autotile/occluder_map = [ ]
|
||||
0/autotile/navpoly_map = [ ]
|
||||
0/autotile/priority_map = [ ]
|
||||
0/autotile/z_index_map = [ ]
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape = SubResource( 12 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 1.0
|
||||
0/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 12 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
0/z_index = 0
|
||||
1/name = "basic_tileset_blobb-jakob-remix.png 1"
|
||||
1/texture = ExtResource( 6 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 32, 0, 16, 16 )
|
||||
1/tile_mode = 1
|
||||
1/autotile/bitmask_mode = 0
|
||||
1/autotile/bitmask_flags = [ ]
|
||||
1/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
1/autotile/tile_size = Vector2( 16, 16 )
|
||||
1/autotile/spacing = 0
|
||||
1/autotile/occluder_map = [ ]
|
||||
1/autotile/navpoly_map = [ ]
|
||||
1/autotile/priority_map = [ ]
|
||||
1/autotile/z_index_map = [ ]
|
||||
1/occluder_offset = Vector2( 0, 0 )
|
||||
1/navigation_offset = Vector2( 0, 0 )
|
||||
1/shape_offset = Vector2( 0, 0 )
|
||||
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
1/shape = SubResource( 13 )
|
||||
1/shape_one_way = false
|
||||
1/shape_one_way_margin = 1.0
|
||||
1/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 13 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
1/z_index = 0
|
||||
|
||||
[node name="Level 1" type="Node2D"]
|
||||
script = ExtResource( 10 )
|
||||
__meta__ = {
|
||||
@ -43,8 +112,11 @@ visible = true
|
||||
[node name="Emitter3" parent="BlobbyCam/ParallaxBackground/ParallaxLayer4" index="1"]
|
||||
visible = true
|
||||
|
||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||
frame = 2
|
||||
|
||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||
frame = 4
|
||||
frame = 5
|
||||
|
||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||
unique_name_in_owner = true
|
||||
@ -354,6 +426,13 @@ scale = Vector2( 1, 1.5 )
|
||||
position = Vector2( 240, -7 )
|
||||
scale = Vector2( 1, 1.5 )
|
||||
|
||||
[node name="TileMap2" type="TileMap" parent="."]
|
||||
tile_set = SubResource( 11 )
|
||||
cell_size = Vector2( 16, 16 )
|
||||
cell_quadrant_size = 8
|
||||
cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 )
|
||||
format = 1
|
||||
|
||||
[connection signal="body_exited" from="Blobby/BlobbySkin" to="Blobby" method="_on_BlobbySkin_body_exited"]
|
||||
|
||||
[editable path="SignalManager"]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -113,11 +113,8 @@ unique_name_in_owner = true
|
||||
drag_margin_top = 0.08
|
||||
drag_margin_bottom = 0.08
|
||||
|
||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||
frame = 7
|
||||
|
||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||
frame = 3
|
||||
frame = 11
|
||||
|
||||
[node name="Blobby" parent="." instance=ExtResource( 5 )]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@ -11,8 +11,8 @@ var states = {}
|
||||
onready var parent = get_parent()
|
||||
|
||||
# Scene Singletons
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
|
||||
# Basic process flow for every SM
|
||||
|
||||
12
src/UserInterface/Buttons/MenuNavigationButton.gd
Normal file
12
src/UserInterface/Buttons/MenuNavigationButton.gd
Normal file
@ -0,0 +1,12 @@
|
||||
extends Button
|
||||
|
||||
export(String, FILE) var next_screen_path: = ""
|
||||
onready var selected_screen_base_path: String = "res://src/UserInterface/Screens"
|
||||
|
||||
func _on_button_up() -> void:
|
||||
get_tree().change_scene(next_screen_path)
|
||||
get_tree().get_current_scene().queue_free()
|
||||
get_tree().paused = false
|
||||
|
||||
func _get_configuration_warning() -> String:
|
||||
return "next_scene_path must be set for the button to work" if next_screen_path == "" else ""
|
||||
13
src/UserInterface/Screens/ControlsMenu/ActionKeyList.gd
Normal file
13
src/UserInterface/Screens/ControlsMenu/ActionKeyList.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Control
|
||||
|
||||
const InputLine = preload("res://src/UserInterface/Screens/ControlsMenu/InputLine.tscn")
|
||||
|
||||
func clear():
|
||||
for child in get_children():
|
||||
child.free()
|
||||
|
||||
func add_input_line(action_name, key, is_customizable=false):
|
||||
var line = InputLine.instance()
|
||||
line.initialize(action_name, key, is_customizable)
|
||||
add_child(line)
|
||||
return line
|
||||
28
src/UserInterface/Screens/ControlsMenu/ControlsMenu.gd
Normal file
28
src/UserInterface/Screens/ControlsMenu/ControlsMenu.gd
Normal file
@ -0,0 +1,28 @@
|
||||
extends Control
|
||||
|
||||
onready var _action_list = $"%ActionKeyList"
|
||||
|
||||
func _ready():
|
||||
$InputMapper.connect('profile_changed', self, 'rebuild')
|
||||
$ProfilesMenu.initialize($InputMapper)
|
||||
$InputMapper.change_profile($ProfilesMenu.selected)
|
||||
|
||||
func rebuild(input_profile, is_customizable=false):
|
||||
_action_list.clear()
|
||||
for input_action in input_profile.keys():
|
||||
var line = _action_list.add_input_line(input_action, \
|
||||
input_profile[input_action], is_customizable)
|
||||
if is_customizable:
|
||||
line.connect('change_button_pressed', self, \
|
||||
'_on_InputLine_change_button_pressed', [input_action, line])
|
||||
|
||||
func _on_InputLine_change_button_pressed(action_name, line):
|
||||
set_process_input(false)
|
||||
|
||||
$KeySelectMenu.open()
|
||||
var key_scancode = yield($KeySelectMenu, "key_selected")
|
||||
$InputMapper.change_action_key(action_name, key_scancode)
|
||||
line.update_key(key_scancode)
|
||||
|
||||
set_process_input(true)
|
||||
|
||||
257
src/UserInterface/Screens/ControlsMenu/ControlsMenu.tscn
Normal file
257
src/UserInterface/Screens/ControlsMenu/ControlsMenu.tscn
Normal file
@ -0,0 +1,257 @@
|
||||
[gd_scene load_steps=23 format=2]
|
||||
|
||||
[ext_resource path="res://assets/ui/Screenshot 2023-05-23 160521.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ProfilesMenu.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ActionKeyList.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputMapper.gd" type="Script" id=4]
|
||||
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5]
|
||||
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=6]
|
||||
[ext_resource path="res://assets/environment/background/space.png" type="Texture" id=7]
|
||||
[ext_resource path="res://assets/environment/background/Spaceship-Wall.png" type="Texture" id=8]
|
||||
[ext_resource path="res://src/transparency.gdshader" type="Shader" id=9]
|
||||
[ext_resource path="res://assets/sounds/EpsonStart.ogg" type="AudioStream" id=10]
|
||||
[ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=11]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ControlsMenu.gd" type="Script" id=12]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/KeySelectMenu.gd" type="Script" id=13]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/SaveButton.gd" type="Script" id=14]
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/Reset.gd" type="Script" id=15]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 42
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=6]
|
||||
shader = ExtResource( 9 )
|
||||
shader_param/transparency = 0.1
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=8]
|
||||
shader = ExtResource( 9 )
|
||||
shader_param/transparency = 0.778
|
||||
|
||||
[sub_resource type="DynamicFont" id=7]
|
||||
size = 20
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[node name="ControlsMenu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource( 5 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="InputMapper" type="Node" parent="."]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 7 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="background2" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 8 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="ProfilesMenu" type="OptionButton" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.165
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.165
|
||||
margin_left = -14.5
|
||||
margin_right = 14.5
|
||||
margin_bottom = 19.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Titel" type="Label" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -170.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 52.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Controlls Menu"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Titel"]
|
||||
material = SubResource( 6 )
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -39.0
|
||||
margin_top = -3.0
|
||||
margin_right = 251.0
|
||||
margin_bottom = 265.0
|
||||
rect_scale = Vector2( 0.0627026, 0.0522158 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="KeymapViewer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.1
|
||||
anchor_top = 0.3
|
||||
anchor_right = 0.9
|
||||
anchor_bottom = 0.75
|
||||
margin_left = -20.0
|
||||
margin_top = -20.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Headers" type="HBoxContainer" parent="KeymapViewer"]
|
||||
margin_right = 552.0
|
||||
margin_bottom = 21.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Action" type="Label" parent="KeymapViewer/Headers"]
|
||||
margin_right = 242.0
|
||||
margin_bottom = 21.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Action"
|
||||
valign = 1
|
||||
|
||||
[node name="Control" type="Label" parent="KeymapViewer/Headers"]
|
||||
margin_left = 246.0
|
||||
margin_right = 305.0
|
||||
margin_bottom = 21.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Button"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Change" type="Label" parent="KeymapViewer/Headers"]
|
||||
margin_left = 309.0
|
||||
margin_right = 552.0
|
||||
margin_bottom = 21.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Edit"
|
||||
align = 2
|
||||
valign = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="KeymapViewer"]
|
||||
margin_top = 25.0
|
||||
margin_right = 552.0
|
||||
margin_bottom = 202.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ActionKeyList" type="VBoxContainer" parent="KeymapViewer/ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 552.0
|
||||
margin_bottom = 177.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Back" type="Button" parent="."]
|
||||
anchor_left = 0.05
|
||||
anchor_top = 0.95
|
||||
anchor_right = 0.05
|
||||
anchor_bottom = 0.95
|
||||
margin_top = -25.0
|
||||
margin_right = 75.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 40, 20 )
|
||||
input_pass_on_modal_close_click = false
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
text = "Back"
|
||||
script = ExtResource( 11 )
|
||||
next_screen_path = "res://src/UserInterface/Screens/MainScreen.tscn"
|
||||
|
||||
[node name="Reset" type="Button" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.95
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.95
|
||||
margin_left = -37.5
|
||||
margin_top = -25.0
|
||||
margin_right = 37.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 40, 20 )
|
||||
input_pass_on_modal_close_click = false
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
text = "Reset"
|
||||
script = ExtResource( 15 )
|
||||
|
||||
[node name="Save" type="Button" parent="."]
|
||||
anchor_left = 0.95
|
||||
anchor_top = 0.95
|
||||
anchor_right = 0.95
|
||||
anchor_bottom = 0.95
|
||||
margin_left = -75.0
|
||||
margin_top = -25.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 40, 20 )
|
||||
input_pass_on_modal_close_click = false
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
text = "Save"
|
||||
script = ExtResource( 14 )
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 10 )
|
||||
volume_db = -10.065
|
||||
autoplay = true
|
||||
bus = "Music"
|
||||
|
||||
[node name="KeySelectMenu" type="Panel" parent="."]
|
||||
visible = false
|
||||
material = SubResource( 8 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 13 )
|
||||
|
||||
[node name="Prompt" type="Label" parent="KeySelectMenu"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -170.0
|
||||
margin_top = -26.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 26.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/font = SubResource( 7 )
|
||||
text = "Press a key (ESC to cancel)"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[connection signal="button_up" from="Back" to="Back" method="_on_button_up"]
|
||||
[connection signal="button_up" from="Reset" to="Reset" method="_on_button_up"]
|
||||
[connection signal="button_up" from="Save" to="Save" method="_on_button_up"]
|
||||
14
src/UserInterface/Screens/ControlsMenu/InputLine.gd
Normal file
14
src/UserInterface/Screens/ControlsMenu/InputLine.gd
Normal file
@ -0,0 +1,14 @@
|
||||
extends HBoxContainer
|
||||
|
||||
signal change_button_pressed
|
||||
|
||||
func initialize(action_name, key, can_change):
|
||||
$Action.text = action_name.capitalize()
|
||||
$Key.text = OS.get_scancode_string(key)
|
||||
$ChangeButton.disabled = !can_change
|
||||
|
||||
func update_key(scancode):
|
||||
$Key.text = OS.get_scancode_string(scancode)
|
||||
|
||||
func _on_ChangeButton_pressed():
|
||||
emit_signal('change_button_pressed')
|
||||
45
src/UserInterface/Screens/ControlsMenu/InputLine.tscn
Normal file
45
src/UserInterface/Screens/ControlsMenu/InputLine.tscn
Normal file
@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputLine.gd" type="Script" id=1]
|
||||
|
||||
[node name="InputLine" type="HBoxContainer"]
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_top = -10.0
|
||||
margin_bottom = 10.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Action" type="Label" parent="."]
|
||||
margin_right = 287.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Up"
|
||||
valign = 1
|
||||
|
||||
[node name="Key" type="Label" parent="."]
|
||||
margin_left = 291.0
|
||||
margin_right = 578.0
|
||||
margin_bottom = 20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "W Key"
|
||||
valign = 1
|
||||
|
||||
[node name="ChangeButton" type="Button" parent="."]
|
||||
margin_left = 582.0
|
||||
margin_right = 640.0
|
||||
margin_bottom = 20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
rect_min_size = Vector2( 40, 20 )
|
||||
input_pass_on_modal_close_click = false
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
text = "Change"
|
||||
icon_align = 1
|
||||
|
||||
[connection signal="pressed" from="ChangeButton" to="." method="_on_ChangeButton_pressed"]
|
||||
58
src/UserInterface/Screens/ControlsMenu/InputMapper.gd
Normal file
58
src/UserInterface/Screens/ControlsMenu/InputMapper.gd
Normal file
@ -0,0 +1,58 @@
|
||||
extends Node
|
||||
|
||||
signal profile_changed(new_profile, is_customizable)
|
||||
|
||||
var current_profile_id = 0
|
||||
|
||||
var profiles = {
|
||||
0: 'keyboard',
|
||||
1: 'controller',
|
||||
2: 'keyboard_default',
|
||||
3: 'controller_default',
|
||||
}
|
||||
|
||||
var keyboard_default = {
|
||||
'move_up': KEY_UP,
|
||||
'move_down': KEY_DOWN,
|
||||
'move_left': KEY_LEFT,
|
||||
'move_right': KEY_RIGHT
|
||||
}
|
||||
|
||||
var controller_default = {
|
||||
'move_up': KEY_W,
|
||||
'move_down': KEY_S,
|
||||
'move_left': KEY_A,
|
||||
'move_right': KEY_D
|
||||
}
|
||||
|
||||
var keyboard = keyboard_default
|
||||
var controller = controller_default
|
||||
|
||||
func change_profile(id):
|
||||
current_profile_id = id
|
||||
var profile = get(profiles[id])
|
||||
var is_customizable = true if id < 2 else false
|
||||
|
||||
for action_name in profile.keys():
|
||||
change_action_key(action_name, profile[action_name])
|
||||
emit_signal('profile_changed', profile, is_customizable)
|
||||
return profile
|
||||
|
||||
func change_action_key(action_name, key_scancode):
|
||||
erase_action_events(action_name)
|
||||
|
||||
var new_event = InputEventKey.new()
|
||||
new_event.set_scancode(key_scancode)
|
||||
InputMap.action_add_event(action_name, new_event)
|
||||
get_selected_profile()[action_name] = key_scancode
|
||||
|
||||
func erase_action_events(action_name):
|
||||
var input_events = InputMap.get_action_list(action_name)
|
||||
for event in input_events:
|
||||
InputMap.action_erase_event(action_name, event)
|
||||
|
||||
func get_selected_profile():
|
||||
return get(profiles[current_profile_id])
|
||||
|
||||
func _on_ProfilesMenu_item_selected(ID):
|
||||
change_profile(ID)
|
||||
21
src/UserInterface/Screens/ControlsMenu/KeySelectMenu.gd
Normal file
21
src/UserInterface/Screens/ControlsMenu/KeySelectMenu.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends Panel
|
||||
|
||||
signal key_selected(scancode)
|
||||
|
||||
func _ready():
|
||||
set_process_input(false)
|
||||
|
||||
func _input(event):
|
||||
if !event.is_pressed():
|
||||
return
|
||||
if event.scancode != 16777217:
|
||||
emit_signal("key_selected", event.scancode)
|
||||
close()
|
||||
|
||||
func open():
|
||||
show()
|
||||
set_process_input(true)
|
||||
|
||||
func close():
|
||||
hide()
|
||||
set_process_input(false)
|
||||
7
src/UserInterface/Screens/ControlsMenu/ProfilesMenu.gd
Normal file
7
src/UserInterface/Screens/ControlsMenu/ProfilesMenu.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
func initialize(input_mapper):
|
||||
for profile_index in input_mapper.profiles:
|
||||
var profile_name = input_mapper.profiles[profile_index].capitalize()
|
||||
add_item(profile_name, profile_index)
|
||||
self.connect("item_selected", input_mapper, "_on_ProfilesMenu_item_selected")
|
||||
7
src/UserInterface/Screens/ControlsMenu/Reset.gd
Normal file
7
src/UserInterface/Screens/ControlsMenu/Reset.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends Button
|
||||
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
func _on_button_up() -> void:
|
||||
InputMap.load_from_globals()
|
||||
SaveManager.save_default()
|
||||
6
src/UserInterface/Screens/ControlsMenu/SaveButton.gd
Normal file
6
src/UserInterface/Screens/ControlsMenu/SaveButton.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends Button
|
||||
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
func _on_button_up() -> void:
|
||||
SaveManager.save_default()
|
||||
@ -7,8 +7,8 @@ onready var timer: Label = $HUDOverlay/GetBackTimer
|
||||
onready var currency: Label = $HUDOverlay/Currency
|
||||
onready var kills: Label = $HUDOverlay/Kills
|
||||
onready var frees: Label = $HUDOverlay/Frees
|
||||
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var levelState := get_tree().root.get_child(2).get_node("%LevelState")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
|
||||
|
||||
func _ready():
|
||||
@ -38,7 +38,7 @@ func _zoom_timer() -> void:
|
||||
|
||||
func update_interface() -> void:
|
||||
|
||||
var wallet = GlobalState.wallet + levelState.currency
|
||||
var wallet = GlobalState.gsr.wallet + levelState.currency
|
||||
|
||||
currency.text = "Orbs: %s" % wallet
|
||||
kills.text = "Kills: %s" % levelState.kills
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://src/UserInterface/Buttons/QuitButton.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/UserInterface/Buttons/Titel.tscn" type="PackedScene" id=2]
|
||||
@ -9,6 +9,13 @@
|
||||
[ext_resource path="res://src/UserInterface/Screens/LevelSelectButtonGroup.tres" type="ButtonGroup" id=7]
|
||||
[ext_resource path="res://assets/environment/background/Spaceship-Wall.png" type="Texture" id=8]
|
||||
[ext_resource path="res://assets/sounds/EpsonStart.ogg" type="AudioStream" id=9]
|
||||
[ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=10]
|
||||
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=11]
|
||||
[ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=12]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 69
|
||||
font_data = ExtResource( 11 )
|
||||
|
||||
[node name="MainScreen" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@ -18,6 +25,8 @@ size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource( 5 )
|
||||
|
||||
[node name="SignalManager" parent="." instance=ExtResource( 12 )]
|
||||
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -41,6 +50,7 @@ margin_bottom = 85.0
|
||||
grow_horizontal = 2
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "bobbi"
|
||||
|
||||
[node name="MenuContainer" type="HBoxContainer" parent="."]
|
||||
@ -60,14 +70,22 @@ size_flags_horizontal = 3
|
||||
|
||||
[node name="PlayButton" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
||||
margin_right = 296.0
|
||||
margin_bottom = 48.0
|
||||
margin_bottom = 30.0
|
||||
next_scene_path = "res://src/Levels/Actual Level 1.tscn"
|
||||
|
||||
[node name="Controlls" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
||||
margin_top = 34.0
|
||||
margin_right = 296.0
|
||||
margin_bottom = 65.0
|
||||
text = "Controls"
|
||||
script = ExtResource( 10 )
|
||||
next_screen_path = "res://src/UserInterface/Screens/ControlsMenu/ControlsMenu.tscn"
|
||||
|
||||
[node name="QuitButton" parent="MenuContainer/Buttons" instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 0.0
|
||||
margin_left = 0.0
|
||||
margin_top = 52.0
|
||||
margin_top = 69.0
|
||||
margin_right = 296.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
|
||||
46
src/Utilities/GlobalState.gd
Normal file
46
src/Utilities/GlobalState.gd
Normal file
@ -0,0 +1,46 @@
|
||||
extends Node
|
||||
|
||||
#export(Dictionary) var progress_dict := {} setget set_progress, get_progress
|
||||
#export(int) var wallet := 0 setget set_wallet
|
||||
#export(Dictionary) var input_map
|
||||
#export(bool) var show_tutorial
|
||||
export(Resource) var gsr
|
||||
|
||||
func set_progress(value) -> void:
|
||||
gsr.progress_dict = value
|
||||
SaveManager.save_default()
|
||||
|
||||
func get_progress() -> Dictionary:
|
||||
return gsr.progress_dict
|
||||
|
||||
func set_savepoint(levelName: String, position: Vector2) -> void:
|
||||
if(!gsr.progress_dict.has(levelName)):
|
||||
gsr.progress_dict[levelName] = {}
|
||||
gsr.progress_dict[levelName]["savepoint"] = position
|
||||
SaveManager.save_default()
|
||||
|
||||
func get_property_value(levelName: String, propertyName: String) -> int:
|
||||
if gsr.progress_dict.has(levelName) && gsr.progress_dict[levelName].has(propertyName):
|
||||
return gsr.progress_dict[levelName][propertyName]
|
||||
else:
|
||||
return 0
|
||||
|
||||
func get_savepoint(levelName: String) -> Vector2:
|
||||
if gsr.progress_dict.has(levelName) && gsr.progress_dict[levelName].has("savepoint"):
|
||||
return gsr.progress_dict[levelName]["savepoint"]
|
||||
else:
|
||||
return Vector2()
|
||||
|
||||
# TODO This is permanent immediatly
|
||||
func set_wallet(value) -> void:
|
||||
gsr.wallet = value
|
||||
SaveManager.save_default()
|
||||
|
||||
func reinstate() -> void:
|
||||
if gsr.input_map.size() <= 1:
|
||||
InputMap.load_from_globals()
|
||||
|
||||
for action in gsr.input_map:
|
||||
InputMap.action_erase_events(action)
|
||||
for input_event in gsr.input_map[action]:
|
||||
InputMap.action_add_event(action, input_event)
|
||||
7
src/Utilities/GlobalStateResource.gd
Normal file
7
src/Utilities/GlobalStateResource.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends Resource
|
||||
class_name GlobalStateResource
|
||||
|
||||
export(Dictionary) var progress_dict := {}
|
||||
export(int) var wallet := 0
|
||||
export(Dictionary) var input_map
|
||||
export(bool) var show_tutorial
|
||||
4
src/Utilities/InputMapLoader.gd
Normal file
4
src/Utilities/InputMapLoader.gd
Normal file
@ -0,0 +1,4 @@
|
||||
extends Node
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
extends Node
|
||||
|
||||
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
|
||||
onready var signalManager := get_tree().root.get_child(2).get_node("%SignalManager")
|
||||
onready var levelName := get_tree().get_current_scene().get_name()
|
||||
|
||||
#TODO Easteregg pls
|
||||
@ -20,6 +20,9 @@ func reset() -> void:
|
||||
kills = 0
|
||||
currency = 0
|
||||
frees = 0
|
||||
# TODO Maybe not the place for this?
|
||||
if GlobalState.gsr.progress_dict.has(levelName):
|
||||
GlobalState.gsr.progress_dict[levelName].erase("savepoint")
|
||||
|
||||
func set_currency(value: int) -> void:
|
||||
currency = value
|
||||
@ -42,14 +45,14 @@ func set_dead(value: bool) -> void:
|
||||
# Spends the currency when enough is available
|
||||
# and returns true if so. Else it does not spend and return false.
|
||||
func spend_currency(cost: int) -> bool:
|
||||
if GlobalState.wallet + currency < cost:
|
||||
if GlobalState.gsr.wallet + currency < cost:
|
||||
return false
|
||||
var remainder = currency - cost
|
||||
if remainder >= 0:
|
||||
currency = remainder
|
||||
else:
|
||||
currency = 0
|
||||
GlobalState.set_wallet(GlobalState.wallet + remainder)
|
||||
GlobalState.set_wallet(GlobalState.gsr.wallet + remainder)
|
||||
return true
|
||||
|
||||
|
||||
@ -74,11 +77,9 @@ func update_global_state() -> void:
|
||||
progress_dict[levelName]["kills"] = GlobalState.get_property_value(levelName,"kills") + kills
|
||||
progress_dict[levelName]["deaths"] = GlobalState.get_property_value(levelName,"deaths") + deaths
|
||||
progress_dict[levelName]["frees"] = GlobalState.get_property_value(levelName,"frees") + frees
|
||||
# TODO This is not the best place for this
|
||||
progress_dict[levelName].erase("savepoint")
|
||||
|
||||
GlobalState.set_wallet(GlobalState.wallet + currency)
|
||||
|
||||
# TODO Wallet is independant from progress_dict because???
|
||||
GlobalState.set_wallet(GlobalState.gsr.wallet + currency)
|
||||
GlobalState.set_progress(progress_dict)
|
||||
|
||||
func player_dying(animation_number: int = 0) -> void:
|
||||
|
||||
@ -7,6 +7,7 @@ signal currency_updated()
|
||||
signal kills_updated()
|
||||
signal frees_updated()
|
||||
signal player_died(animation_number)
|
||||
# TODO The persisting process could be cancelled when the level is unloaded
|
||||
signal level_completed()
|
||||
signal power_up_collected(kind)
|
||||
signal got_stomped()
|
||||
|
||||
8
src/transparency.gdshader
Normal file
8
src/transparency.gdshader
Normal file
@ -0,0 +1,8 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float transparency : hint_range(0.0, 1.0) = 0.5;
|
||||
|
||||
void fragment() {
|
||||
COLOR = texture(TEXTURE, UV);
|
||||
COLOR.a = transparency;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user