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):
for x in range(40):
if(player_inventory_items[x].item_id == itemid):
print(str(player_inventory_items[x]))
player_inventory_items[x].amount += amount
return
#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
get_tree().get_root().add_child(river_intersection_home_2)
"inventory_screen":
inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
current_scene = 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")
var velocity = Vector2()
var world_position
#Moving buttons
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()
velocity.y += delta * GRAVITY
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)
func InteractWithCell():
var plant_cell = plants_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(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)
if plant_cell == 1:
var plant_cell_mouse = plants_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / 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 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)
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)
# plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 4)
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()
# plants_map.set_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y), 10)
func _input(event):
pass
func AnimationOnInteraction(Item):
print(Item, "Animation")
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))

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]
[resource]
0/name = "Plants 0"
0/name = "Plants.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )