mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
beep boop Shared.gd
This commit is contained in:
parent
7ab68eedfa
commit
31359611e8
6 changed files with 55 additions and 44 deletions
|
|
@ -33,6 +33,7 @@ config/icon="res://icon.png"
|
|||
[autoload]
|
||||
|
||||
btn="*res://src/autoload/btn.gd"
|
||||
Shared="*res://src/autoload/Shared.gd"
|
||||
|
||||
[display]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ func set_rotation(degrees):
|
|||
|
||||
func _on_Area2D_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
print("win")
|
||||
Shared.advance_map(1)
|
||||
Shared.load_map()
|
||||
|
|
|
|||
46
src/autoload/Shared.gd
Normal file
46
src/autoload/Shared.gd
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
extends Node
|
||||
|
||||
var map_path : String = "res://src/map/"
|
||||
var maps : Array = []
|
||||
|
||||
var current_map : int = 0
|
||||
|
||||
func _ready():
|
||||
print("Shared._ready(): ")
|
||||
|
||||
get_maps()
|
||||
|
||||
# current map
|
||||
for i in maps.size():
|
||||
if map_path + maps[i] + ".tscn" ==get_tree().current_scene.filename:
|
||||
current_map = i
|
||||
print("current map: ", current_map)
|
||||
|
||||
func advance_map(arg):
|
||||
current_map = clamp(current_map + arg, 0, maps.size() - 1)
|
||||
|
||||
func load_map():
|
||||
get_tree().change_scene(map_path + maps[current_map] + ".tscn")
|
||||
|
||||
func list_folder(path):
|
||||
var dir = Directory.new()
|
||||
if dir.open(path) != OK:
|
||||
print("list_folder(): '", map_path, "' not found")
|
||||
return
|
||||
|
||||
var list = []
|
||||
dir.list_dir_begin(true)
|
||||
|
||||
var fname = dir.get_next()
|
||||
while fname != "":
|
||||
list.append(fname)
|
||||
fname = dir.get_next()
|
||||
|
||||
return list
|
||||
|
||||
func get_maps():
|
||||
maps = []
|
||||
for i in list_folder(map_path):
|
||||
if i.ends_with(".tscn"):
|
||||
maps.append(i.trim_suffix(".tscn"))
|
||||
print("get_maps(): ", maps)
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
] instance=ExtResource( 1 )]
|
||||
|
||||
[node name="SolidTileMap" parent="." instance=ExtResource( 2 )]
|
||||
tile_data = PoolIntArray( 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 65542, 0, 0, 65543, 0, 0, 65544, 0, 0, 65545, 0, 0, 65546, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 131079, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 327689, 0, 0, 327690, 0, 0 )
|
||||
tile_data = PoolIntArray( 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 655363, 0, 0, 655364, 0, 0, 655365, 0, 0, 720899, 0, 0, 720900, 0, 0, 720901, 0, 0, 786435, 0, 0, 786436, 0, 0, 786437, 0, 0, 983043, 0, 0, 983044, 0, 0, 983045, 0, 0, 1048579, 0, 0, 1048580, 0, 0, 1048581, 0, 0, 1114115, 0, 0, 1114116, 0, 0, 1114117, 0, 0 )
|
||||
|
||||
[node name="Actors" type="Node2D" parent="."]
|
||||
|
||||
[node name="Player" parent="Actors" instance=ExtResource( 3 )]
|
||||
position = Vector2( 393.327, 148.512 )
|
||||
position = Vector2( 447.272, 148.671 )
|
||||
|
||||
[node name="Exit" parent="Actors" instance=ExtResource( 4 )]
|
||||
position = Vector2( 900, 300 )
|
||||
position = Vector2( 450, 1900 )
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
] instance=ExtResource( 1 )]
|
||||
|
||||
[node name="SolidTileMap" parent="." instance=ExtResource( 2 )]
|
||||
tile_data = PoolIntArray( -131066, 0, 0, -131065, 0, 0, -131064, 0, 0, -131063, 0, 0, -131062, 0, 0, -131061, 0, 0, -65530, 0, 0, -65529, 0, 0, -65528, 0, 0, -65527, 0, 0, -65526, 0, 0, -65525, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 65542, 0, 0, 65543, 0, 0, 65544, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 131079, 0, 0, 131080, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 196616, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0 )
|
||||
tile_data = PoolIntArray( -65527, 0, 0, -65526, 0, 0, -65525, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 65545, 0, 0, 65546, 0, 0, 65547, 0, 0, 131074, 0, 0, 131075, 0, 0, 131076, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0 )
|
||||
|
||||
[node name="Actors" type="Node2D" parent="."]
|
||||
|
||||
[node name="Player" parent="Actors" instance=ExtResource( 3 )]
|
||||
position = Vector2( 413.508, 138.421 )
|
||||
position = Vector2( 354.039, 142.314 )
|
||||
|
||||
[node name="Exit" parent="Actors" instance=ExtResource( 4 )]
|
||||
position = Vector2( 1000, 350 )
|
||||
position = Vector2( 1300, 50 )
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://src/stage/Camera2D.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/stage/SolidTileMap.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/actor/Player.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/actor/Exit.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/actor/Lock.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://src/actor/Key.tscn" type="PackedScene" id=6]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="Camera2D" parent="." groups=[
|
||||
"game_camera",
|
||||
] instance=ExtResource( 1 )]
|
||||
|
||||
[node name="SolidTileMap" parent="." instance=ExtResource( 2 )]
|
||||
tile_data = PoolIntArray( -131067, 0, 0, -131066, 0, 0, -131065, 0, 0, -131064, 0, 0, -131063, 0, 0, -131062, 0, 0, -65531, 0, 0, -65530, 0, 0, -65529, 0, 0, -65528, 0, 0, -65527, 0, 0, -65526, 0, 0, 9, 0, 0, 10, 0, 0, 65545, 0, 0, 65546, 0, 0, 131081, 0, 0, 131082, 0, 0, 196608, 0, 0, 196609, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 196616, 0, 0, 196617, 0, 0, 196618, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 0, 0, 327680, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 327689, 0, 0, 327690, 0, 0 )
|
||||
|
||||
[node name="Actors" type="Node2D" parent="."]
|
||||
|
||||
[node name="Player" parent="Actors" instance=ExtResource( 3 )]
|
||||
position = Vector2( 346.16, 221.483 )
|
||||
|
||||
[node name="Exit" parent="Actors" instance=ExtResource( 4 )]
|
||||
position = Vector2( 750, 150 )
|
||||
|
||||
[node name="Lock" parent="Actors" instance=ExtResource( 5 )]
|
||||
position = Vector2( 550, 50 )
|
||||
|
||||
[node name="Lock2" parent="Actors" instance=ExtResource( 5 )]
|
||||
position = Vector2( 550, 150 )
|
||||
|
||||
[node name="Lock3" parent="Actors" instance=ExtResource( 5 )]
|
||||
position = Vector2( 550, 250 )
|
||||
|
||||
[node name="Key" parent="Actors" instance=ExtResource( 6 )]
|
||||
position = Vector2( 750, -250 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue