diff --git a/Global.gd b/Global.gd index 5ff7461..ceddba3 100644 --- a/Global.gd +++ b/Global.gd @@ -49,6 +49,13 @@ func RemoveScene(scene): print("Removing scene ", scene) var camera = get_node("/root/base_scene/Camera2D") camera.remove_child(scene) + +func AddMap(mapname): + var maps = load(mapname).instance().get_children() + for i in maps: + print(get_tree().get_root()) + get_tree().get_root().add_child(i) + print('Added ', i) #Go to scene by name func GoToScene(scene): diff --git a/MiscCodes/KinematicBody2D.gd b/MiscCodes/KinematicBody2D.gd index a2dfe34..2bce40b 100644 --- a/MiscCodes/KinematicBody2D.gd +++ b/MiscCodes/KinematicBody2D.gd @@ -86,3 +86,4 @@ func AnimationOnInteraction(Item): func _ready(): Global.player_inventory_items = Database.GetInventoryItems().duplicate() print("Map = ", Global.map_name) + diff --git a/MiscCodes/Tilemap_CameraView.gd b/MiscCodes/Tilemap_CameraView.gd index c3dc3f8..10138e6 100644 --- a/MiscCodes/Tilemap_CameraView.gd +++ b/MiscCodes/Tilemap_CameraView.gd @@ -6,6 +6,7 @@ onready var background_map = get_node("/root/base_scene/background") onready var screen_size = self.get_viewport_rect().size func _ready(): + var map_name = "res://Maps/river_intersection" calculate_bounds() Global.current_camera = self $dev_statistics.visible = Global.dev_stats @@ -21,6 +22,8 @@ var max_y_pixel = 0 #function that calculates the borders/bounds of the map func calculate_bounds(): + for _i in self.get_parent().get_children(): + print("Nodes visible ", _i) var used_cells = background_map.get_used_cells() for pos in used_cells: if pos.x < min_x: diff --git a/MiscScenes/Menu.tscn b/MiscScenes/Menu.tscn index f9b5e52..d3bfe20 100644 --- a/MiscScenes/Menu.tscn +++ b/MiscScenes/Menu.tscn @@ -54,6 +54,5 @@ text = "Load Game" __meta__ = { "_edit_use_anchors_": false } - [connection signal="pressed" from="Btn_PlayGame" to="." method="_on_Btn_PlayGame_pressed"] [connection signal="pressed" from="Btn_LoadGame" to="." method="_on_Btn_LoadGame_pressed"] diff --git a/Other/base_tilemap/base_tilemap.tscn b/Other/base_tilemap/base_tilemap.tscn index 699b63b..168f953 100644 --- a/Other/base_tilemap/base_tilemap.tscn +++ b/Other/base_tilemap/base_tilemap.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=19 format=2] +[gd_scene load_steps=18 format=2] [ext_resource path="res://pictures/gui/player_interaction.tres" type="TileSet" id=1] -[ext_resource path="res://MiscCodes/background_script.gd" type="Script" id=2] [ext_resource path="res://MiscCodes/Tilemap_CameraView.gd" type="Script" id=3] [ext_resource path="res://MiscCodes/TouchScreenButton.gd" type="Script" id=4] [ext_resource path="res://MiscCodes/KinematicBody2D.gd" type="Script" id=5] @@ -25,29 +24,6 @@ radius = 20.0 [node name="base_scene" type="Node2D"] script = ExtResource( 6 ) -[node name="background" type="TileMap" parent="."] -cell_size = Vector2( 32, 32 ) -cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) -format = 1 -script = ExtResource( 2 ) - -[node name="vegetation" type="TileMap" parent="."] -cell_size = Vector2( 32, 32 ) -format = 1 - -[node name="interaction_map" type="TileMap" parent="."] -cell_size = Vector2( 32, 32 ) -cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) -centered_textures = true -format = 1 - -[node name="player_interaction" type="TileMap" parent="."] -tile_set = ExtResource( 1 ) -cell_size = Vector2( 32, 32 ) -cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) -format = 1 -tile_data = PoolIntArray( 9371749, 0, 0 ) - [node name="Camera2D" type="Camera2D" parent="."] position = Vector2( 705.297, 1197.88 ) z_index = 15 @@ -192,7 +168,6 @@ shape = SubResource( 2 ) action = "map_interaction" [node name="Tween" type="Tween" parent="."] -[connection signal="released" from="Camera2D/Interactive/GameButtons/Inventory" to="background" method="_on_Inventory_released"] [connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveDown" to="Player" method="_on_TouchScreenButton_pressed"] [connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveRight" to="Player" method="_on_TouchScreenButton_pressed"] [connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveUp" to="Player" method="_on_TouchScreenButton_pressed"] diff --git a/Other/base_tilemap/init.gd b/Other/base_tilemap/init.gd index 3f6903a..43aae1b 100644 --- a/Other/base_tilemap/init.gd +++ b/Other/base_tilemap/init.gd @@ -1,5 +1,13 @@ extends Node2D -func _ready(): - var map_name = "res://Maps/river_intersection" - self.add_child(Global.load_scene(map_name)) +func _init(): + var map_name = "res://Maps/river_intersection.tscn" + Global.AddMap(map_name) +# for _i in self.get_children(): +# print("Nodes visible ",_i) +# if _i is TileMap: +# print("Checking ", _i) +# for x in 300: +# for y in 300: +# if _i.get_cell(x, y) != -1: +# print(_i.get_cell(x, y)) diff --git a/project.godot b/project.godot index 83a48e8..3eeb57f 100644 --- a/project.godot +++ b/project.godot @@ -130,9 +130,9 @@ pointing/emulate_touch_from_mouse=true [rendering] quality/driver/driver_name="GLES2" -2d/snapping/use_gpu_pixel_snap=true -vram_compression/import_etc=true quality/2d/use_pixel_snap=true +vram_compression/import_etc=true +2d/snapping/use_gpu_pixel_snap=true [tiled_importer]