Compare commits
No commits in common. "7ee29cbe9825a1ee3c4687d499cecb1894044bc6" and "95b05c36035669ab0a2181f04d0d906eeeba0e9d" have entirely different histories.
7ee29cbe98
...
95b05c3603
@ -17,7 +17,8 @@ func load_scene(map_data):
|
|||||||
map_name = map_data
|
map_name = map_data
|
||||||
var scene = load(map_data+".tscn")
|
var scene = load(map_data+".tscn")
|
||||||
print("MAP NAME ",map_data+".tscn")
|
print("MAP NAME ",map_data+".tscn")
|
||||||
return scene.instance()
|
var map = scene.instance()
|
||||||
|
return map
|
||||||
|
|
||||||
func AddInventoryItem(itemid, amount):
|
func AddInventoryItem(itemid, amount):
|
||||||
for x in range(40):
|
for x in range(40):
|
||||||
|
@ -4,10 +4,11 @@ const GRAVITY = 0.0
|
|||||||
const WALK_SPEED = 200
|
const WALK_SPEED = 200
|
||||||
const interaction_circle_size = 150
|
const interaction_circle_size = 150
|
||||||
#onready var background_map = get_node("/root/base_scene/background")
|
#onready var background_map = get_node("/root/base_scene/background")
|
||||||
onready var background_map = get_node("../background")
|
onready var background_map = get_parent().get_node("background")
|
||||||
onready var vegetation_map = get_node("../vegetation")
|
#onready var background_map = get_node("background")
|
||||||
onready var interaction_map = get_node("../interaction_map")
|
onready var vegetation_map = get_parent().get_node("vegetation")
|
||||||
onready var player_interaction_map = get_node("../player_interaction")
|
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()
|
onready var cell_size = background_map._get_cell_size()
|
||||||
|
|
||||||
var velocity = Vector2()
|
var velocity = Vector2()
|
||||||
@ -41,18 +42,11 @@ func _physics_process(delta):
|
|||||||
Global.current_camera.Update()
|
Global.current_camera.Update()
|
||||||
|
|
||||||
func InteractWithCell():
|
func InteractWithCell():
|
||||||
for _i in self.get_parent().get_children():
|
for _i in self.get_children():
|
||||||
print("Nodes visible ",_i)
|
print(_i)
|
||||||
if _i is TileMap:
|
print(background_map)
|
||||||
print("Checking ", _i)
|
print(interaction_map)
|
||||||
for x in 300:
|
var plant_cell_mouse = interaction_map.get_cell(int(world_position[0] / cell_size.x), int(world_position[0] / cell_size.y))
|
||||||
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))
|
|
||||||
var plant_cell_character = interaction_map.get_cell(int(self.position.x / cell_size.x), int(self.position.y / 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))
|
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 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)
|
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:
|
if plant_cell_mouse > 0 and plant_cell_mouse % 2 == 0:
|
||||||
Global.AddInventoryItem(plant_cell_mouse/2, 1)
|
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))
|
interaction_map.set_cell(int(world_position[0] / cell_size.x), int(world_position[1] / cell_size.y), (plant_cell_mouse-1))
|
||||||
AnimationOnInteraction(1)
|
AnimationOnInteraction(1)
|
||||||
GlobalGameFunctions.SoundOnInteraction(self, "standard")
|
|
||||||
Global.Save()
|
Global.Save()
|
||||||
elif plant_cell_character > 0 and plant_cell_character % 2 == 0:
|
elif plant_cell_character > 0 and plant_cell_character % 2 == 0:
|
||||||
Global.AddInventoryItem(plant_cell_character/2, 1)
|
Global.AddInventoryItem(plant_cell_character/2, 1)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
extends TouchScreenButton
|
extends TouchScreenButton
|
||||||
|
|
||||||
|
#func _input(always):
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if Input.is_action_pressed("move_left") and Input.is_action_pressed("move_right"):
|
if Input.is_action_pressed("move_left") and Input.is_action_pressed("move_right"):
|
||||||
show()
|
show()
|
||||||
elif Input.is_action_pressed("ui_end"):
|
elif Input.is_action_pressed("ui_end"):
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
||||||
|
@ -10,9 +10,9 @@ func _unhandled_input(event):
|
|||||||
var pl_pos = player.position
|
var pl_pos = player.position
|
||||||
var pl_pos_tile = Vector2(pl_pos.x / cell_size.x, pl_pos.y / cell_size.y)
|
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)
|
var pl_tile = get_cellv(pl_pos_tile)
|
||||||
# if event == Input.action_press("map_interaction"):
|
if event == Input.action_press("map_interaction"):
|
||||||
# if(pl_tile != -1):
|
if(pl_tile != -1):
|
||||||
# set_cellv(pl_pos_tile, -1)
|
set_cellv(pl_pos_tile, -1)
|
||||||
|
|
||||||
func _on_Settings_pressed():
|
func _on_Settings_pressed():
|
||||||
Global.GoToScene("menu")
|
Global.GoToScene("menu")
|
||||||
|
Loading…
Reference in New Issue
Block a user