This commit is contained in:
Eljakim Herrewijnen 2021-04-03 16:09:02 +02:00
commit a86a5ed396
13 changed files with 672 additions and 24 deletions

View File

@ -12,6 +12,7 @@ var dev_stats = true
func AddInventoryItem(itemid, amount): func AddInventoryItem(itemid, amount):
for x in range(40): for x in range(40):
if(player_inventory_items[x].item_id == itemid): if(player_inventory_items[x].item_id == itemid):
print(str(player_inventory_items[x]))
player_inventory_items[x].amount += amount player_inventory_items[x].amount += amount
return return
#if we reached here then no exisiting item is found and we iterate the array again #if we reached here then no exisiting item is found and we iterate the array again
@ -32,6 +33,7 @@ func GoToScene(scene):
current_scene = river_intersection_home_2 current_scene = river_intersection_home_2
get_tree().get_root().add_child(river_intersection_home_2) get_tree().get_root().add_child(river_intersection_home_2)
"inventory_screen": "inventory_screen":
inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
current_scene = inventory_screen current_scene = inventory_screen
get_tree().get_root().add_child(inventory_screen) get_tree().get_root().add_child(inventory_screen)

View File

@ -10,10 +10,11 @@ onready var plants_map = get_node("/root/Map1/interaction_map")
onready var interaction = get_node("/root/Map1/player_interaction") onready var interaction = get_node("/root/Map1/player_interaction")
var velocity = Vector2() var velocity = Vector2()
var world_position
#Moving buttons #Moving buttons
func _physics_process(delta): func _physics_process(delta):
if Input.is_key_pressed(KEY_SPACE): if Input.is_key_pressed(KEY_SPACE) or Input.is_mouse_button_pressed(BUTTON_LEFT):
_interaction_process() _interaction_process()
velocity.y += delta * GRAVITY velocity.y += delta * GRAVITY
if Input.is_action_pressed("move_left"): if Input.is_action_pressed("move_left"):
@ -34,26 +35,30 @@ func _physics_process(delta):
# interaction.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 0) # interaction.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 0)
func InteractWithCell(): func InteractWithCell():
var plant_cell = plants_map.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) var plant_cell_mouse = plants_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y))
var background_cell = background_map.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) var plant_cell_character = plants_map.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y))
var interaction_cell = interaction.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y))
print(plant_cell) var background_cell = background_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y))
if plant_cell == 1: 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(3, 1)
plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 4) 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)
plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), (plant_cell_character-1))
AnimationOnInteraction(1) AnimationOnInteraction(1)
# plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 4)
func _interaction_process(): func _interaction_process():
if Input.is_action_pressed("map_interaction") or Input.is_key_pressed((KEY_SPACE)): if Input.is_key_pressed(KEY_SPACE) or Input.is_mouse_button_pressed(BUTTON_LEFT):
world_position = get_global_mouse_position()
InteractWithCell() InteractWithCell()
# plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 10)
func _input(event): func _input(event):
pass pass
func AnimationOnInteraction(Item): func AnimationOnInteraction(Item):
print(Item, "Animation") print("Item = ", Item, " Animation")
var itemimage = TextureRect.new() var itemimage = TextureRect.new()
itemimage.texture = load("res://pictures/inventory_iconpictures/food_items/herbs/saffron.png") itemimage.texture = load("res://pictures/inventory_iconpictures/food_items/herbs/saffron.png")
itemimage.set_position(Vector2(randf()*20-40, randf()*40-20)) itemimage.set_position(Vector2(randf()*20-40, randf()*40-20))

480
Other/Vloer.json Normal file
View File

@ -0,0 +1,480 @@
{ "columns":0,
"margin":0,
"name":"Vloer",
"spacing":0,
"tilecount":78,
"tiledversion":"1.4.2",
"tileheight":32,
"tiles":[
{
"id":0,
"image":"omgeving\/vloer32x32\/grond_gras_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":1,
"image":"omgeving\/vloer32x32\/grond_gras_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":2,
"image":"omgeving\/vloer32x32\/grond_gras_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":3,
"image":"omgeving\/vloer32x32\/grond_gras_links1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":4,
"image":"omgeving\/vloer32x32\/grond_gras_links2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":5,
"image":"omgeving\/vloer32x32\/grond_gras_links3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":6,
"image":"omgeving\/vloer32x32\/grond_gras_rechts1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":7,
"image":"omgeving\/vloer32x32\/grond_gras_rechts2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":8,
"image":"omgeving\/vloer32x32\/grond_gras_rechts3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":9,
"image":"omgeving\/vloer32x32\/grond_met_plantjes1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":10,
"image":"omgeving\/vloer32x32\/grond_met_plantjes2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":11,
"image":"omgeving\/vloer32x32\/grond_met_plantjes3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":12,
"image":"omgeving\/vloer32x32\/grond1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":13,
"image":"omgeving\/vloer32x32\/grond2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":14,
"image":"omgeving\/vloer32x32\/grond3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":15,
"image":"omgeving\/vloer32x32\/water_zand_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":16,
"image":"omgeving\/vloer32x32\/water_zand_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":17,
"image":"omgeving\/vloer32x32\/water_zand_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":18,
"image":"omgeving\/vloer32x32\/water_zand_links_en_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":19,
"image":"omgeving\/vloer32x32\/water_zand_links_en_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":20,
"image":"omgeving\/vloer32x32\/water_zand_links_en_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":21,
"image":"omgeving\/vloer32x32\/water_zand_links_en_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":22,
"image":"omgeving\/vloer32x32\/water_zand_links_en_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":23,
"image":"omgeving\/vloer32x32\/water_zand_links_en_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":24,
"image":"omgeving\/vloer32x32\/water_zand_links1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":25,
"image":"omgeving\/vloer32x32\/water_zand_links2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":26,
"image":"omgeving\/vloer32x32\/water_zand_links3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":27,
"image":"omgeving\/vloer32x32\/water_zand_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":28,
"image":"omgeving\/vloer32x32\/water_zand_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":29,
"image":"omgeving\/vloer32x32\/water_zand_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":30,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":31,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":32,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":33,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":34,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":35,
"image":"omgeving\/vloer32x32\/water_zand_rechts_en_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":36,
"image":"omgeving\/vloer32x32\/water_zand_rechts1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":37,
"image":"omgeving\/vloer32x32\/water_zand_rechts2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":38,
"image":"omgeving\/vloer32x32\/water_zand_rechts3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":39,
"image":"omgeving\/vloer32x32\/water1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":40,
"image":"omgeving\/vloer32x32\/water2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":41,
"image":"omgeving\/vloer32x32\/water3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":42,
"image":"omgeving\/vloer32x32\/zand1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":43,
"image":"omgeving\/vloer32x32\/zand2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":44,
"image":"omgeving\/vloer32x32\/zand3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":45,
"image":"omgeving\/vloer32x32\/grond_gras_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":46,
"image":"omgeving\/vloer32x32\/grond_gras_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":47,
"image":"omgeving\/vloer32x32\/grond_gras_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":48,
"image":"omgeving\/vloer32x32\/zand_grond_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":49,
"image":"omgeving\/vloer32x32\/zand_grond_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":50,
"image":"omgeving\/vloer32x32\/zand_grond_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":51,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":52,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":53,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":54,
"image":"omgeving\/vloer32x32\/zand_grond_rechts1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":55,
"image":"omgeving\/vloer32x32\/zand_grond_rechts2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":56,
"image":"omgeving\/vloer32x32\/zand_grond_rechts3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":57,
"image":"omgeving\/vloer32x32\/zand_grond_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":58,
"image":"omgeving\/vloer32x32\/zand_grond_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":59,
"image":"omgeving\/vloer32x32\/zand_grond_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":60,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":61,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":62,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":63,
"image":"omgeving\/vloer32x32\/zand_grond_links1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":64,
"image":"omgeving\/vloer32x32\/zand_grond_links2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":65,
"image":"omgeving\/vloer32x32\/zand_grond_links3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":66,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_boven1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":67,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_boven2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":68,
"image":"omgeving\/vloer32x32\/zand_grond_rechts_en_boven3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":69,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_onder1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":70,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_onder2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":71,
"image":"omgeving\/vloer32x32\/zand_grond_links_en_onder3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":72,
"image":"omgeving\/vloer32x32\/stenenpad1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":73,
"image":"omgeving\/vloer32x32\/stenenpad2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":74,
"image":"omgeving\/vloer32x32\/stenenpad3.png",
"imageheight":32,
"imagewidth":32
},
{
"id":75,
"image":"omgeving\/vloer32x32\/water_met_stapsteen1.png",
"imageheight":32,
"imagewidth":32
},
{
"id":76,
"image":"omgeving\/vloer32x32\/water_met_stapsteen2.png",
"imageheight":32,
"imagewidth":32
},
{
"id":77,
"image":"omgeving\/vloer32x32\/water_met_stapsteen3.png",
"imageheight":32,
"imagewidth":32
}],
"tilewidth":32,
"type":"tileset",
"version":1.4
}

20
Other/Vloer.json.import Normal file
View File

@ -0,0 +1,20 @@
[remap]
importer="vnen.tiled_importer"
type="PackedScene"
valid=false
[deps]
source_file="res://Other/Vloer.json"
[params]
custom_properties=true
tile_metadata=false
uv_clip=true
image_flags=7
collision_layer=1
embed_internal_images=false
save_tiled_properties=false
add_background=true
post_import_script=""

View File

@ -3,7 +3,7 @@
[ext_resource path="res://Plants.png" type="Texture" id=1] [ext_resource path="res://Plants.png" type="Texture" id=1]
[resource] [resource]
0/name = "Plants 0" 0/name = "Plants.png 0"
0/texture = ExtResource( 1 ) 0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 ) 0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 ) 0/modulate = Color( 1, 1, 1, 1 )

Binary file not shown.

View File

@ -64,8 +64,8 @@ func _on_Tween_tween_completed(object, key):
lockedPlayerCamera = false lockedPlayerCamera = false
func AnimateMoveCamera(source, destination, key, time): func AnimateMoveCamera(source, destination, key, time):
lockedPlayerCamera = true
var tween = get_node("/root/Map1/Tween") var tween = get_node("/root/Map1/Tween")
lockedPlayerCamera = true
tween.interpolate_property(get_node("/root/Map1/Camera2D"), key, source, destination, time, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) tween.interpolate_property(get_node("/root/Map1/Camera2D"), key, source, destination, time, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start() tween.start()

View File

@ -16,6 +16,5 @@ func _unhandled_input(event):
if(pl_tile != -1): if(pl_tile != -1):
set_cellv(pl_pos_tile, -1) set_cellv(pl_pos_tile, -1)
func _on_Inventory_pressed(): func _on_Inventory_pressed():
Global.GoToScene("inventory_screen") Global.GoToScene("inventory_screen")

BIN
interaction_map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/interaction_map.png-724d8ee208334da0bf4fbbe07c843337.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://interaction_map.png"
dest_files=[ "res://.import/interaction_map.png-724d8ee208334da0bf4fbbe07c843337.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

BIN
vegetation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

34
vegetation.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/vegetation.png-9b7a68023c07aeb73b70da1191b13e9f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://vegetation.png"
dest_files=[ "res://.import/vegetation.png-9b7a68023c07aeb73b70da1191b13e9f.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