From 0f6876f96f4781222db855f69fb5aeae6e473f3d Mon Sep 17 00:00:00 2001 From: Jonathan Herrewijnen Date: Thu, 8 Apr 2021 21:18:46 +0200 Subject: [PATCH] Latest changes. Working on animations. --- MiscCodes/Item.gd | 4 +-- MiscCodes/KinematicBody2D.gd | 21 +++++++---- .../food_items/surroundings/berries.png | Bin 0 -> 1034 bytes .../surroundings/berries.png.import | 34 ++++++++++++++++++ .../plants/wood_log.png | Bin 0 -> 727 bytes .../plants/wood_log.png.import | 34 ++++++++++++++++++ river_intersection_home2.tscn | 2 +- 7 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 pictures/inventory_iconpictures/food_items/surroundings/berries.png create mode 100644 pictures/inventory_iconpictures/food_items/surroundings/berries.png.import create mode 100644 pictures/inventory_iconpictures/plants/wood_log.png create mode 100644 pictures/inventory_iconpictures/plants/wood_log.png.import diff --git a/MiscCodes/Item.gd b/MiscCodes/Item.gd index af67796..730e640 100644 --- a/MiscCodes/Item.gd +++ b/MiscCodes/Item.gd @@ -10,9 +10,9 @@ func _ready(): # Id 0-40 - Map foraging - 'Random' spawning 1: - $TextureRect.texture = load("res://pictures/inventory_iconpictures/miscellaneous/magic_formulae.png") + $TextureRect.texture = load("res://pictures/inventory_iconpictures/food_items/surroundings/berries.png") 2: - $TextureRect.texture = load("res://pictures/inventory_iconpictures/tools_and_weapons/tools/ploeg.png") + $TextureRect.texture = load("res://pictures/inventory_iconpictures/plants/wood_log.png.png") 3: $TextureRect.texture = load("res://pictures/inventory_iconpictures/food_items/herbs/saffron.png") diff --git a/MiscCodes/KinematicBody2D.gd b/MiscCodes/KinematicBody2D.gd index 08dbaab..629364c 100644 --- a/MiscCodes/KinematicBody2D.gd +++ b/MiscCodes/KinematicBody2D.gd @@ -11,6 +11,7 @@ onready var interaction = get_node("/root/Map1/player_interaction") var velocity = Vector2() var world_position +var ItemClass = preload("res://MiscScenes/Item.tscn") #Moving buttons func _physics_process(delta): @@ -41,11 +42,11 @@ func InteractWithCell(): var background_cell = background_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y)) var interaction_cell = interaction.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y)) if plant_cell_mouse > 0 and plant_cell_mouse % 2 == 0: - Global.AddInventoryItem(3, 1) + Global.AddInventoryItem(plant_cell_mouse/2, 1) plants_map.set_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y), (plant_cell_mouse-1)) AnimationOnInteraction(1) elif plant_cell_character > 0 and plant_cell_character % 2 == 0: - Global.AddInventoryItem(3, 1) + Global.AddInventoryItem(plant_cell_character/2, 1) plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), (plant_cell_character-1)) AnimationOnInteraction(1) @@ -60,11 +61,17 @@ func _input(event): func AnimationOnInteraction(Item): print("Item = ", Item, " Animation") var itemimage = TextureRect.new() - itemimage.texture = load("res://pictures/inventory_iconpictures/food_items/herbs/saffron.png") - itemimage.set_position(Vector2(randf()*20-40, randf()*40-20)) - add_child(itemimage) - yield(get_tree().create_timer(1.0), "timeout") - remove_child(itemimage) + var item = null +# item = ItemClass.instance() +# item.set("id", self.id) +# add_child(item) +# itemimage.texture = load(Global.player_inventory_items[Item].item_id) + +# itemimage.texture = load("res://pictures/inventory_iconpictures/food_items/herbs/saffron.png") +# itemimage.set_position(Vector2(randf()*20-40, randf()*40-20)) +# add_child(itemimage) +# yield(get_tree().create_timer(1.0), "timeout") +# remove_child(itemimage) func _ready(): Global.player_inventory_items = Database.GetInventoryItems() diff --git a/pictures/inventory_iconpictures/food_items/surroundings/berries.png b/pictures/inventory_iconpictures/food_items/surroundings/berries.png new file mode 100644 index 0000000000000000000000000000000000000000..ec59771e3657af00d1a460ea3526ab004f56b830 GIT binary patch literal 1034 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WChCQ1^9%x0>u}n2-f@Ybp)oq6Wv9r`|a*O}6_P|x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