Latest changes. Working on animations.

This commit is contained in:
Jonathan Herrewijnen 2021-04-08 21:18:46 +02:00
parent 3d382a9833
commit 0f6876f96f
7 changed files with 85 additions and 10 deletions

View File

@ -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")

View File

@ -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()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/berries.png-a098b38cace86f4a86643ba45a8a4cc2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://pictures/inventory_iconpictures/food_items/surroundings/berries.png"
dest_files=[ "res://.import/berries.png-a098b38cace86f4a86643ba45a8a4cc2.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=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/wood_log.png-f6d5101b0118d43e396e1614cb788936.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://pictures/inventory_iconpictures/plants/wood_log.png"
dest_files=[ "res://.import/wood_log.png-f6d5101b0118d43e396e1614cb788936.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=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

File diff suppressed because one or more lines are too long