Compare commits
No commits in common. "a0d3ded1853a0a1bf50645d62b4d62711155f73b" and "8e8ec8e75957c2e212a822d870369fc125795e34" have entirely different histories.
a0d3ded185
...
8e8ec8e759
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=12 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2]
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=5]
|
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://src/Camera2D.gd" type="Script" id=6]
|
[ext_resource path="res://src/Camera2D.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://src/Main.gd" type="Script" id=7]
|
[ext_resource path="res://src/Main.gd" type="Script" id=7]
|
||||||
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=8]
|
|
||||||
|
|
||||||
[sub_resource type="Shader" id=2]
|
[sub_resource type="Shader" id=2]
|
||||||
code = "shader_type canvas_item;
|
code = "shader_type canvas_item;
|
||||||
|
|
@ -69,7 +68,3 @@ position = Vector2( 160, 90 )
|
||||||
current = true
|
current = true
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
tracking_node_path = NodePath("../CameraGuide")
|
tracking_node_path = NodePath("../CameraGuide")
|
||||||
|
|
||||||
[node name="MushroomIcon" type="Sprite" parent="ViewportContainer/Viewport"]
|
|
||||||
position = Vector2( 60, 160 )
|
|
||||||
texture = ExtResource( 8 )
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ extends Node
|
||||||
var player_position: Vector2
|
var player_position: Vector2
|
||||||
var player_health: int
|
var player_health: int
|
||||||
var player_stamina: int
|
var player_stamina: int
|
||||||
var player_inventory: InventoryManager
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ func _ready():
|
||||||
add_child(item_sprite)
|
add_child(item_sprite)
|
||||||
item_sprite.play()
|
item_sprite.play()
|
||||||
|
|
||||||
func trigger_interaction():
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
# 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):
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,13 @@ export var player_number: int = 1
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
|
||||||
onready var player_inventory :InventoryManager = InventoryManager.new()
|
|
||||||
|
|
||||||
#var mushroom :Item = preload("res://assets/items/doodad.tres")
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
PlayerInfo.player_health = $Health_Component.health
|
PlayerInfo.player_health = $Health_Component.health
|
||||||
PlayerInfo.player_inventory = player_inventory
|
|
||||||
# Set initial player position in world.
|
# Set initial player position in world.
|
||||||
global_position = LevelInfo.player_start_position
|
global_position = LevelInfo.player_start_position
|
||||||
|
|
||||||
# player_inventory.add_to_inventory(mushroom)
|
|
||||||
# player_inventory.select_primary(mushroom)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
|
@ -54,8 +46,4 @@ func touch_the_thing(the_thing: Interactable) -> bool:
|
||||||
transform.x.x = movement_component.LEFT
|
transform.x.x = movement_component.LEFT
|
||||||
movement_state_machine.change_to_known_state('enter_right')
|
movement_state_machine.change_to_known_state('enter_right')
|
||||||
the_thing.trigger_interaction()
|
the_thing.trigger_interaction()
|
||||||
if the_thing is ItemPickup:
|
|
||||||
player_inventory.add_to_inventory(the_thing.item)
|
|
||||||
player_inventory.select_primary(the_thing.item)
|
|
||||||
the_thing.trigger_interaction()
|
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
class_name InventoryManager
|
class_name InventoryManager
|
||||||
extends Resource
|
extends Resource
|
||||||
## Currently doing this in a weird way where the inventory items are the
|
|
||||||
## dictionary keys. This would make world inventory items ownable
|
|
||||||
## by the resourse itself. At least that's what I think. We'll see.
|
|
||||||
## I'm interested in an approach where the game world items aren't
|
|
||||||
## duplicated.
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
|
|
@ -20,14 +15,6 @@ var _items :Dictionary
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
func select_primary(_item :Item) -> void:
|
|
||||||
if _items.has(_item):
|
|
||||||
primary_selection = _item
|
|
||||||
|
|
||||||
func select_secondary(_item :Item) -> void:
|
|
||||||
if _items.has(_item):
|
|
||||||
secondary_selection = _item
|
|
||||||
|
|
||||||
func add_to_inventory(_item :Item) -> int:
|
func add_to_inventory(_item :Item) -> int:
|
||||||
if _items.has(_item):
|
if _items.has(_item):
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,7 @@ onready var DialogContainerText = $PanelContainer/HSplitContainer/Label
|
||||||
|
|
||||||
onready var DialogIndicator = $PanelContainer/Polygon2D
|
onready var DialogIndicator = $PanelContainer/Polygon2D
|
||||||
|
|
||||||
onready var health_bar = $HealthBar
|
onready var HUD = $HealthBar
|
||||||
|
|
||||||
## Cool I can bring this in with a ctrl drag
|
|
||||||
onready var selected_inventory_items = $"%SelectedInventoryItems"
|
|
||||||
|
|
||||||
|
|
||||||
var current_pane
|
var current_pane
|
||||||
|
|
||||||
|
|
@ -43,11 +39,11 @@ func _process(delta):
|
||||||
print("UI Switch detected")
|
print("UI Switch detected")
|
||||||
current_pane = UiManager.current_pane
|
current_pane = UiManager.current_pane
|
||||||
DialogContainer.visible = false
|
DialogContainer.visible = false
|
||||||
health_bar.visible = false
|
HUD.visible = false
|
||||||
match current_pane:
|
match current_pane:
|
||||||
UiManager.UI_PANES.HUD:
|
UiManager.UI_PANES.HUD:
|
||||||
print("Enable HUD")
|
print("Enable HUD")
|
||||||
health_bar.visible = true
|
HUD.visible = true
|
||||||
UiManager.UI_PANES.DIALOG:
|
UiManager.UI_PANES.DIALOG:
|
||||||
print("Enable Dialog")
|
print("Enable Dialog")
|
||||||
DialogContainerPortrait.texture = UiManager.dialog_portrait
|
DialogContainerPortrait.texture = UiManager.dialog_portrait
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2]
|
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=2]
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
[ext_resource path="res://src/ui/HealthBar.gd" type="Script" id=5]
|
[ext_resource path="res://src/ui/HealthBar.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6]
|
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=6]
|
||||||
[ext_resource path="res://assets/UI/Staminabar-Indicator.png" type="Texture" id=7]
|
[ext_resource path="res://assets/UI/Staminabar-Indicator.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://src/ui/SelectedInventoryItems.gd" type="Script" id=8]
|
|
||||||
|
|
||||||
[node name="HUD" type="CanvasLayer"]
|
[node name="HUD" type="CanvasLayer"]
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
|
|
@ -97,22 +96,3 @@ margin_bottom = 40.0
|
||||||
margin_left = 13.0
|
margin_left = 13.0
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
|
||||||
[node name="SelectedInventoryItems" type="HBoxContainer" parent="."]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
margin_left = 2.0
|
|
||||||
margin_top = -18.0
|
|
||||||
margin_right = 48.0
|
|
||||||
margin_bottom = -2.0
|
|
||||||
rect_clip_content = true
|
|
||||||
script = ExtResource( 8 )
|
|
||||||
|
|
||||||
[node name="PrimaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
|
||||||
margin_bottom = 16.0
|
|
||||||
|
|
||||||
[node name="SecondaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
|
||||||
margin_left = 4.0
|
|
||||||
margin_right = 4.0
|
|
||||||
margin_bottom = 16.0
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
extends HBoxContainer
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
onready var primary_item = $PrimaryItem
|
|
||||||
onready var secondary_item = $SecondaryItem
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass
|
|
||||||
#secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
if (PlayerInfo.player_inventory.primary_selection):
|
|
||||||
primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user