Compare commits

..

No commits in common. "7ee29cbe9825a1ee3c4687d499cecb1894044bc6" and "95b05c36035669ab0a2181f04d0d906eeeba0e9d" have entirely different histories.

4 changed files with 23 additions and 21 deletions

View File

@ -17,7 +17,8 @@ func load_scene(map_data):
map_name = map_data
var scene = load(map_data+".tscn")
print("MAP NAME ",map_data+".tscn")
return scene.instance()
var map = scene.instance()
return map
func AddInventoryItem(itemid, amount):
for x in range(40):

View File

@ -4,10 +4,11 @@ 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("../background")
onready var vegetation_map = get_node("../vegetation")
onready var interaction_map = get_node("../interaction_map")
onready var player_interaction_map = get_node("../player_interaction")
onready var background_map = get_parent().get_node("background")
#onready var background_map = 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()
var velocity = Vector2()
@ -41,18 +42,11 @@ func _physics_process(delta):
Global.current_camera.Update()
func InteractWithCell():
for _i in self.get_parent().get_children():
print("Nodes visible ",_i)
if _i is TileMap:
print("Checking ", _i)
for x in 300:
for y in 300:
if _i.get_cell(x, y) != -1:
print(_i.get_cell(x, y))
# else:
# _i.set_cell(x, y, 1)
var plant_cell_mouse = interaction_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y))
for _i in self.get_children():
print(_i)
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))
@ -60,12 +54,12 @@ func InteractWithCell():
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")
if plant_cell_mouse > 0 and plant_cell_mouse % 2 == 0:
Global.AddInventoryItem(plant_cell_mouse/2, 1)
interaction_map.set_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y), (plant_cell_mouse-1))
AnimationOnInteraction(1)
GlobalGameFunctions.SoundOnInteraction(self, "standard")
Global.Save()
elif plant_cell_character > 0 and plant_cell_character % 2 == 0:
Global.AddInventoryItem(plant_cell_character/2, 1)

View File

@ -1,7 +1,14 @@
extends TouchScreenButton
#func _input(always):
func _physics_process(delta):
if Input.is_action_pressed("move_left") and Input.is_action_pressed("move_right"):
show()
elif Input.is_action_pressed("ui_end"):
hide()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -10,9 +10,9 @@ func _unhandled_input(event):
var pl_pos = player.position
var pl_pos_tile = Vector2(pl_pos.x / cell_size.x, pl_pos.y / cell_size.y)
var pl_tile = get_cellv(pl_pos_tile)
# if event == Input.action_press("map_interaction"):
# if(pl_tile != -1):
# set_cellv(pl_pos_tile, -1)
if event == Input.action_press("map_interaction"):
if(pl_tile != -1):
set_cellv(pl_pos_tile, -1)
func _on_Settings_pressed():
Global.GoToScene("menu")