merged
This commit is contained in:
commit
b7631b694f
16
Global.gd
16
Global.gd
@ -6,6 +6,8 @@ var player_inventory_items = []
|
|||||||
var river_intersection_home_2 = preload("res://river_intersection_home2.tscn").instance()
|
var river_intersection_home_2 = preload("res://river_intersection_home2.tscn").instance()
|
||||||
var inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
var inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
||||||
var current_scene = null
|
var current_scene = null
|
||||||
|
var current_camera = null
|
||||||
|
var dev_stats = true
|
||||||
|
|
||||||
func AddInventoryItem(itemid, amount):
|
func AddInventoryItem(itemid, amount):
|
||||||
for x in range(40):
|
for x in range(40):
|
||||||
@ -22,7 +24,6 @@ func AddInventoryItem(itemid, amount):
|
|||||||
player_inventory_items[x].shortdesc = "desc"
|
player_inventory_items[x].shortdesc = "desc"
|
||||||
player_inventory_items[x].item_id = itemid
|
player_inventory_items[x].item_id = itemid
|
||||||
player_inventory_items[x].amount = amount
|
player_inventory_items[x].amount = amount
|
||||||
return
|
|
||||||
|
|
||||||
func GoToScene(scene):
|
func GoToScene(scene):
|
||||||
if current_scene != null:
|
if current_scene != null:
|
||||||
@ -31,7 +32,6 @@ func GoToScene(scene):
|
|||||||
"river_intersection_home_2":
|
"river_intersection_home_2":
|
||||||
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)
|
||||||
#.change_scene_to(river_intersection_home_2)
|
|
||||||
"inventory_screen":
|
"inventory_screen":
|
||||||
inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
||||||
current_scene = inventory_screen
|
current_scene = inventory_screen
|
||||||
@ -48,6 +48,7 @@ func _ready():
|
|||||||
get_tree().get_root().add_child(river_intersection_home_2)
|
get_tree().get_root().add_child(river_intersection_home_2)
|
||||||
get_tree().get_root().add_child(inventory_screen)
|
get_tree().get_root().add_child(inventory_screen)
|
||||||
pass
|
pass
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
func CheckDBInUserDir():
|
func CheckDBInUserDir():
|
||||||
var file2Check = File.new()
|
var file2Check = File.new()
|
||||||
@ -60,3 +61,14 @@ func CheckDBInUserDir():
|
|||||||
dir.make_dir("user://Storage/")
|
dir.make_dir("user://Storage/")
|
||||||
print("Database not found, making one!")
|
print("Database not found, making one!")
|
||||||
pass
|
pass
|
||||||
|
=======
|
||||||
|
|
||||||
|
func Log(msg, level=1):
|
||||||
|
match level:
|
||||||
|
1:
|
||||||
|
print("[Log]" + msg)
|
||||||
|
2:
|
||||||
|
print("[Warn]" + msg)
|
||||||
|
3:
|
||||||
|
print("[Err]" + msg)
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
|
@ -29,7 +29,7 @@ func _physics_process(delta):
|
|||||||
velocity.x = 0
|
velocity.x = 0
|
||||||
velocity.y = 0
|
velocity.y = 0
|
||||||
move_and_slide(velocity, Vector2(0, -1))
|
move_and_slide(velocity, Vector2(0, -1))
|
||||||
#Global.current_camera.Update()
|
Global.current_camera.Update()
|
||||||
# if(interaction.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) == -1):
|
# if(interaction.get_cell(int(self.position.x / cell_size.x), int(self.position.y / cell_size.y)) == -1):
|
||||||
# interaction.clear()
|
# interaction.clear()
|
||||||
# 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)
|
||||||
|
64
Scenes/Inventory.tscn
Normal file
64
Scenes/Inventory.tscn
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://pictures/gui/backgrounds/inventory/inventory_background.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Scenes/Inventory_Script.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://Scenes/TextureRect2.gd" type="Script" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id=1]
|
||||||
|
script/source = "extends Node2D
|
||||||
|
|
||||||
|
#func _draw():
|
||||||
|
# var center = Vector2(200, 200)
|
||||||
|
# var radius = 80
|
||||||
|
# var angle_from = 75
|
||||||
|
# var angle_to = 195
|
||||||
|
# var color = Color(1.0, 0.0, 0.0)
|
||||||
|
# draw_circle_arc(center, radius, angle_from, angle_to, color)
|
||||||
|
#
|
||||||
|
#func draw_circle_arc(center, radius, angle_from, angle_to, color):
|
||||||
|
# var nb_points = 32
|
||||||
|
# var points_arc = PoolVector2Array()
|
||||||
|
#
|
||||||
|
# for i in range(nb_points + 1):
|
||||||
|
# var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
|
||||||
|
# points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
|
||||||
|
#
|
||||||
|
# for index_point in range(nb_points):
|
||||||
|
# draw_line(points_arc[index_point], points_arc[index_point + 1], color)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Inventory" type="Node2D"]
|
||||||
|
z_index = 1
|
||||||
|
script = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="inventory_background" type="Sprite" parent="TextureRect"]
|
||||||
|
position = Vector2( 617.053, 299.964 )
|
||||||
|
scale = Vector2( 3.08457, 1.99938 )
|
||||||
|
z_index = -1
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="TextureRect2" type="TextureRect" parent="TextureRect/inventory_background"]
|
||||||
|
margin_left = -200.045
|
||||||
|
margin_top = -150.028
|
||||||
|
margin_right = -160.045
|
||||||
|
margin_bottom = -110.028
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
@ -56,6 +56,13 @@ func GetInventoryItems():
|
|||||||
var ret = []
|
var ret = []
|
||||||
ret = db.select_rows("player_inventory", "",["*"])
|
ret = db.select_rows("player_inventory", "",["*"])
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
func SaveInventory(inventory):
|
||||||
|
if(inventory == null or len(inventory) != 40):
|
||||||
|
Global.Log("Bad inventory save!", 3)
|
||||||
|
return
|
||||||
|
OpenConnectionIfClosed()
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
# pass
|
# pass
|
||||||
|
@ -7,6 +7,8 @@ onready var screen_size = self.get_viewport_rect().size
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
calculate_bounds()
|
calculate_bounds()
|
||||||
|
Global.current_camera = self
|
||||||
|
$dev_statistics.visible = Global.dev_stats
|
||||||
|
|
||||||
var once = true
|
var once = true
|
||||||
var lockedPlayerCamera = false
|
var lockedPlayerCamera = false
|
||||||
@ -35,6 +37,8 @@ func calculate_bounds():
|
|||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if(Global.dev_stats):
|
||||||
|
$dev_statistics/fps_stats.text = "FPS: " + str(Performance.get_monitor(Performance.TIME_FPS))
|
||||||
CameraToPlayer()
|
CameraToPlayer()
|
||||||
if once:
|
if once:
|
||||||
once = false
|
once = false
|
||||||
@ -57,8 +61,13 @@ func MoveCamera(x, y):
|
|||||||
|
|
||||||
func _on_Tween_tween_completed(object, key):
|
func _on_Tween_tween_completed(object, key):
|
||||||
print(object, key)
|
print(object, key)
|
||||||
|
<<<<<<< HEAD
|
||||||
lockedPlayerCamera = false
|
lockedPlayerCamera = false
|
||||||
|
|
||||||
|
=======
|
||||||
|
lockedPlayerCamera = false
|
||||||
|
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
func AnimateMoveCamera(source, destination, key, time):
|
func AnimateMoveCamera(source, destination, key, time):
|
||||||
var tween = get_node("/root/Map1/Tween")
|
var tween = get_node("/root/Map1/Tween")
|
||||||
lockedPlayerCamera = true
|
lockedPlayerCamera = true
|
||||||
@ -69,4 +78,5 @@ func CameraToPlayer():
|
|||||||
if lockedPlayerCamera == false:
|
if lockedPlayerCamera == false:
|
||||||
MoveCamera(player.position.x, player.position.y)
|
MoveCamera(player.position.x, player.position.y)
|
||||||
|
|
||||||
|
func Update():
|
||||||
|
CameraToPlayer()
|
||||||
|
@ -177,9 +177,15 @@ scale = Vector2( 1.73434, 1.80493 )
|
|||||||
z_index = 13
|
z_index = 13
|
||||||
normal = ExtResource( 14 )
|
normal = ExtResource( 14 )
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[node name="MoveDown" type="TouchScreenButton" parent="Camera2D"]
|
[node name="MoveDown" type="TouchScreenButton" parent="Camera2D"]
|
||||||
position = Vector2( -480.965, 177.248 )
|
position = Vector2( -480.965, 177.248 )
|
||||||
scale = Vector2( 14.9928, 15.4117 )
|
scale = Vector2( 14.9928, 15.4117 )
|
||||||
|
=======
|
||||||
|
[node name="MoveDown" type="TouchScreenButton" parent="Camera2D/Interactive/GameButtons"]
|
||||||
|
position = Vector2( 224.332, 1376.07 )
|
||||||
|
scale = Vector2( 14.9928, 14.9987 )
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
z_index = 11
|
z_index = 11
|
||||||
normal = ExtResource( 9 )
|
normal = ExtResource( 9 )
|
||||||
pressed = ExtResource( 8 )
|
pressed = ExtResource( 8 )
|
||||||
@ -188,9 +194,15 @@ action = "move_down"
|
|||||||
visibility_mode = 1
|
visibility_mode = 1
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[node name="MoveRight" type="TouchScreenButton" parent="Camera2D"]
|
[node name="MoveRight" type="TouchScreenButton" parent="Camera2D"]
|
||||||
position = Vector2( 478.572, -180.258 )
|
position = Vector2( 478.572, -180.258 )
|
||||||
scale = Vector2( 17.2806, 5.66904 )
|
scale = Vector2( 17.2806, 5.66904 )
|
||||||
|
=======
|
||||||
|
[node name="MoveRight" type="TouchScreenButton" parent="Camera2D/Interactive/GameButtons"]
|
||||||
|
position = Vector2( 1183.87, 1024.23 )
|
||||||
|
scale = Vector2( 16.7497, 5.49206 )
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
z_index = 11
|
z_index = 11
|
||||||
normal = ExtResource( 3 )
|
normal = ExtResource( 3 )
|
||||||
pressed = ExtResource( 7 )
|
pressed = ExtResource( 7 )
|
||||||
@ -198,8 +210,13 @@ action = "move_right"
|
|||||||
visibility_mode = 1
|
visibility_mode = 1
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[node name="MoveUp" type="TouchScreenButton" parent="Camera2D"]
|
[node name="MoveUp" type="TouchScreenButton" parent="Camera2D"]
|
||||||
position = Vector2( -479.063, -300.979 )
|
position = Vector2( -479.063, -300.979 )
|
||||||
|
=======
|
||||||
|
[node name="MoveUp" type="TouchScreenButton" parent="Camera2D/Interactive/GameButtons"]
|
||||||
|
position = Vector2( 224.361, 899.343 )
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
scale = Vector2( 14.9907, 15.5676 )
|
scale = Vector2( 14.9907, 15.5676 )
|
||||||
z_index = 11
|
z_index = 11
|
||||||
normal = ExtResource( 9 )
|
normal = ExtResource( 9 )
|
||||||
@ -208,8 +225,13 @@ action = "move_up"
|
|||||||
visibility_mode = 1
|
visibility_mode = 1
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[node name="MoveLeft" type="TouchScreenButton" parent="Camera2D"]
|
[node name="MoveLeft" type="TouchScreenButton" parent="Camera2D"]
|
||||||
position = Vector2( -615.955, -175.807 )
|
position = Vector2( -615.955, -175.807 )
|
||||||
|
=======
|
||||||
|
[node name="MoveLeft" type="TouchScreenButton" parent="Camera2D/Interactive/GameButtons"]
|
||||||
|
position = Vector2( 89.342, 1022.54 )
|
||||||
|
>>>>>>> a86a5ed396e8b5af82563c3405f7d58bf75fc5a9
|
||||||
scale = Vector2( 16.8861, 5.52137 )
|
scale = Vector2( 16.8861, 5.52137 )
|
||||||
z_index = 11
|
z_index = 11
|
||||||
z_as_relative = false
|
z_as_relative = false
|
||||||
@ -220,6 +242,20 @@ action = "move_left"
|
|||||||
visibility_mode = 1
|
visibility_mode = 1
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
|
[node name="dev_statistics" type="MarginContainer" parent="Camera2D"]
|
||||||
|
margin_left = -615.0
|
||||||
|
margin_top = -300.0
|
||||||
|
margin_right = 614.0
|
||||||
|
margin_bottom = 297.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="fps_stats" type="Label" parent="Camera2D/dev_statistics"]
|
||||||
|
margin_top = 291.0
|
||||||
|
margin_right = 1229.0
|
||||||
|
margin_bottom = 305.0
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D" parent="."]
|
[node name="Player" type="KinematicBody2D" parent="."]
|
||||||
position = Vector2( 700, 1200 )
|
position = Vector2( 700, 1200 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
@ -242,8 +278,8 @@ action = "map_interaction"
|
|||||||
|
|
||||||
[node name="Tween" type="Tween" parent="."]
|
[node name="Tween" type="Tween" parent="."]
|
||||||
[connection signal="pressed" from="Camera2D/Interactive/GameButtons/Inventory" to="background" method="_on_Inventory_pressed"]
|
[connection signal="pressed" from="Camera2D/Interactive/GameButtons/Inventory" to="background" method="_on_Inventory_pressed"]
|
||||||
[connection signal="pressed" from="Camera2D/MoveDown" to="Player" method="_on_TouchScreenButton_pressed"]
|
[connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveDown" to="Player" method="_on_TouchScreenButton_pressed"]
|
||||||
[connection signal="pressed" from="Camera2D/MoveRight" to="Player" method="_on_TouchScreenButton_pressed"]
|
[connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveRight" to="Player" method="_on_TouchScreenButton_pressed"]
|
||||||
[connection signal="pressed" from="Camera2D/MoveUp" to="Player" method="_on_TouchScreenButton_pressed"]
|
[connection signal="pressed" from="Camera2D/Interactive/GameButtons/MoveUp" to="Player" method="_on_TouchScreenButton_pressed"]
|
||||||
[connection signal="released" from="Player/CollisionShape2D/MapInteraction" to="Player" method="_interaction_process"]
|
[connection signal="released" from="Player/CollisionShape2D/MapInteraction" to="Player" method="_interaction_process"]
|
||||||
[connection signal="tween_completed" from="Tween" to="Camera2D" method="_on_Tween_tween_completed"]
|
[connection signal="tween_completed" from="Tween" to="Camera2D" method="_on_Tween_tween_completed"]
|
||||||
|
Loading…
Reference in New Issue
Block a user