diff --git a/Maps/river_intersection.tscn b/Maps/river_intersection.tscn index b9c0deb..dde44ab 100644 --- a/Maps/river_intersection.tscn +++ b/Maps/river_intersection.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://MiscCodes/background_script.gd" type="Script" id=17] [ext_resource path="res://pictures/tileset_images/interaction_map.png" type="Texture" id=18] -[sub_resource type="TileSet" id=1] +[sub_resource type="TileSet" id=5] 0/name = "vegetation.png 0" 0/texture = ExtResource( 4 ) 0/tex_offset = Vector2( 0, 0 ) @@ -36,6 +36,7 @@ polygon = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 ) points = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 ) [sub_resource type="TileSet" id=4] +resource_local_to_scene = true 0/name = "interaction_map.png 0" 0/texture = ExtResource( 18 ) 0/tex_offset = Vector2( 0, 0 ) @@ -154,7 +155,7 @@ tile_data = PoolIntArray( 0, 0, 39, 1, 0, 39, 2, 0, 39, 3, 0, 39, 4, 0, 39, 5, 0 script = ExtResource( 17 ) [node name="vegetation" type="TileMap" parent="."] -tile_set = SubResource( 1 ) +tile_set = SubResource( 5 ) cell_size = Vector2( 32, 32 ) format = 1 tile_data = PoolIntArray( 1179654, 0, 8, 1179655, 0, 0, 1245190, 0, 4, 1245191, 0, 5, 2097157, 0, 2, 2097158, 0, 7, 2097159, 0, 5, 2097160, 0, 1, 2162693, 0, 7, 2162694, 0, 6, 2162695, 0, 1, 2162696, 0, 7, 2162697, 0, 3, 2162698, 0, 4, 2162699, 0, 3, 2162700, 0, 7, 2162701, 0, 8, 2162702, 0, 5, 2228227, 0, 7, 2228228, 0, 4, 2228229, 0, 4, 2228230, 0, 0, 2228231, 0, 2, 2228232, 0, 7, 2228233, 0, 7, 2228234, 0, 8, 2228235, 0, 1, 2228236, 0, 4, 2228237, 0, 2, 2228238, 0, 1, 2228239, 0, 4, 2293763, 0, 5, 2293764, 0, 0, 2293765, 0, 2, 2293767, 0, 5, 2293768, 0, 4, 2293769, 0, 1, 2293770, 0, 8, 2293771, 0, 2, 2293772, 0, 6, 2293773, 0, 4, 2293774, 0, 3, 2293775, 0, 3, 2359299, 0, 6, 2359300, 0, 4, 2359301, 0, 3, 2359302, 0, 3, 2359303, 0, 6, 2359304, 0, 3, 2359305, 0, 8, 2359306, 0, 7, 2359307, 0, 1, 2359308, 0, 4, 2359309, 0, 2, 2359310, 0, 3, 2359311, 0, 0, 2359312, 0, 0, 2424835, 0, 0, 2424836, 0, 3, 2424837, 0, 5, 2424838, 0, 3, 2424839, 0, 5, 2424840, 0, 4, 2424841, 0, 1, 2424842, 0, 0, 2424843, 0, 1, 2424844, 0, 0, 2424845, 0, 6, 2424846, 0, 7, 2424847, 0, 8, 2424848, 0, 1, 2424849, 0, 3, 2424851, 0, 4, 2424852, 0, 0, 2490371, 0, 7, 2490372, 0, 5, 2490373, 0, 5, 2490375, 0, 4, 2490376, 0, 1, 2490377, 0, 5, 2490378, 0, 1, 2490379, 0, 1, 2490380, 0, 3, 2490381, 0, 4, 2490382, 0, 6, 2490383, 0, 4, 2490384, 0, 0, 2490385, 0, 1, 2490388, 0, 4, 2555907, 0, 6, 2555908, 0, 0, 2555909, 0, 4, 2555910, 0, 0, 2555911, 0, 2, 2555912, 0, 2, 2555913, 0, 8, 2555914, 0, 2, 2555915, 0, 0, 2555916, 0, 6, 2555917, 0, 4, 2555918, 0, 1, 2555919, 0, 2, 2555920, 0, 6, 2555921, 0, 2, 2555922, 0, 8, 2621443, 0, 2, 2621444, 0, 8, 2621445, 0, 7, 2621446, 0, 0, 2621447, 0, 8, 2621448, 0, 8, 2621449, 0, 7, 2621450, 0, 0, 2621451, 0, 6, 2621452, 0, 6, 2621453, 0, 2, 2621454, 0, 5, 2621455, 0, 8, 2621456, 0, 7, 2621457, 0, 0, 2621458, 0, 8, 2621459, 0, 5, 2686980, 0, 3, 2686981, 0, 6, 2686982, 0, 1, 2686983, 0, 4, 2686984, 0, 0, 2686985, 0, 6, 2686986, 0, 5, 2686987, 0, 4, 2686988, 0, 1, 2686989, 0, 2, 2686990, 0, 8, 2686991, 0, 8, 2686992, 0, 8, 2686993, 0, 8, 2686994, 0, 4, 2752517, 0, 1, 2752518, 0, 4, 2752519, 0, 6, 2752520, 0, 8, 2752521, 0, 2, 2752522, 0, 6, 2752523, 0, 2, 2752524, 0, 8, 2752525, 0, 5, 2752526, 0, 8 ) @@ -165,7 +166,7 @@ cell_size = Vector2( 32, 32 ) cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) centered_textures = true format = 1 -tile_data = PoolIntArray( 2293767, 4, 0, 2293773, 2, 0, 2359308, 2, 0, 2359309, 2, 0, 2359310, 2, 0, 2424844, 2, 0, 2424845, 2, 0, 2490381, 2, 0, 2752538, 6, 0 ) +tile_data = PoolIntArray( 2293767, 4, 0, 2293772, 1, 0, 2293773, 2, 0, 2293774, 1, 0, 2359302, 0, 0, 2359303, 0, 0, 2359307, 1, 0, 2359308, 2, 0, 2359309, 2, 0, 2359310, 2, 0, 2424843, 1, 0, 2424844, 2, 0, 2424845, 2, 0, 2490380, 1, 0, 2490381, 2, 0, 2752538, 6, 0 ) [node name="player_interaction" type="TileMap" parent="."] tile_set = ExtResource( 2 ) diff --git a/MiscCodes/KinematicBody2D.gd b/MiscCodes/KinematicBody2D.gd index 12330b5..f9d97e4 100644 --- a/MiscCodes/KinematicBody2D.gd +++ b/MiscCodes/KinematicBody2D.gd @@ -3,11 +3,12 @@ extends KinematicBody2D const GRAVITY = 0.0 const WALK_SPEED = 200 const interaction_circle_size = 150 -onready var background_map = get_node("/root/base_scene/background") +#onready var background_map = get_node("/root/base_scene/background") +onready var background_map = get_parent().get_node("background") +onready var vegetation_map = get_parent().get_node("vegetation") +onready var interaction_map = get_parent().get_node("interaction_map") +onready var player_interaction_map = get_parent().get_node("player_interaction") onready var cell_size = background_map._get_cell_size() -onready var player = get_node("/root/base_scene/Player") -onready var interaction_map = get_node("/root/base_scene/interaction_map") -onready var player_interaction = get_node("/root/base_scene/player_interaction") var velocity = Vector2() var world_position @@ -18,8 +19,8 @@ var previous_position = Vector2(0,0) func _physics_process(delta): var cur = Vector2(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) if(cur != previous_position): - player_interaction.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y) , 0) - player_interaction.set_cell(previous_position.x, previous_position.y, -1) + player_interaction_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y) , 0) + player_interaction_map.set_cell(previous_position.x, previous_position.y, -1) previous_position = Vector2(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) if Input.is_action_just_pressed("interact_with_cell"): _interaction_process() @@ -40,15 +41,22 @@ func _physics_process(delta): Global.current_camera.Update() func InteractWithCell(): + print(background_map) + print(interaction_map) var plant_cell_mouse = interaction_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[0] / cell_size.y)) var plant_cell_character = interaction_map.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) var background_cell = background_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y)) - var interaction_cell = player_interaction.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y)) + var interaction_cell = player_interaction_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y)) print("plant cell mouse line 1: ", interaction_map.get_cell(12, 36)) print('plant_cell_mouse=',plant_cell_mouse,' | plant_cell_character=', plant_cell_character,' | background_cell=', background_cell,' | interaction_cell=',interaction_cell) GlobalGameFunctions.SoundOnInteraction(self, "standard") + for i in 150: + for j in 150: + if interaction_map.get_cell(int(i),int(j)) != -1: + print(interaction_map.get_cell(int(i),int(j))) + print(i, j) if plant_cell_mouse > 0 and plant_cell_mouse % 2 == 0: Global.AddInventoryItem(plant_cell_mouse/2, 1) @@ -60,7 +68,6 @@ func InteractWithCell(): interaction_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), (plant_cell_character-1)) AnimationOnInteraction(1) else: - #space is now a test function pass func _interaction_process(): diff --git a/Other/base_tilemap/tilesets/background_ts.tres b/Other/base_tilemap/tilesets/background_ts.tres index 09ee046..a685b52 100644 --- a/Other/base_tilemap/tilesets/background_ts.tres +++ b/Other/base_tilemap/tilesets/background_ts.tres @@ -2,7 +2,6 @@ [ext_resource path="res://Other/base_tilemap/tilesets/background_ts.png" type="Texture" id=1] - [resource] 0/name = "background_ts.png 0" 0/texture = ExtResource( 1 )