Compare commits
No commits in common. "18424079b4ef54354bd8ea7ab79c76a42d9d0f69" and "12da9e3334fff09c7974916db23fc050865b61f6" have entirely different histories.
18424079b4
...
12da9e3334
|
|
@ -37,7 +37,6 @@ margin_bottom = 182.0
|
||||||
rect_scale = Vector2( 2, 2 )
|
rect_scale = Vector2( 2, 2 )
|
||||||
|
|
||||||
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
|
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
|
||||||
unique_name_in_owner = true
|
|
||||||
size = Vector2( 320, 180 )
|
size = Vector2( 320, 180 )
|
||||||
handle_input_locally = false
|
handle_input_locally = false
|
||||||
render_target_update_mode = 3
|
render_target_update_mode = 3
|
||||||
|
|
@ -55,7 +54,6 @@ position = Vector2( 112, 56 )
|
||||||
[node name="UI_Layer" parent="ViewportContainer/Viewport" instance=ExtResource( 3 )]
|
[node name="UI_Layer" parent="ViewportContainer/Viewport" instance=ExtResource( 3 )]
|
||||||
|
|
||||||
[node name="CameraGuide" type="KinematicBody2D" parent="ViewportContainer/Viewport"]
|
[node name="CameraGuide" type="KinematicBody2D" parent="ViewportContainer/Viewport"]
|
||||||
unique_name_in_owner = true
|
|
||||||
position = Vector2( 160, 90 )
|
position = Vector2( 160, 90 )
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 256
|
collision_mask = 256
|
||||||
|
|
@ -67,7 +65,6 @@ shape = SubResource( 1 )
|
||||||
one_way_collision = true
|
one_way_collision = true
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="ViewportContainer/Viewport"]
|
[node name="Camera2D" type="Camera2D" parent="ViewportContainer/Viewport"]
|
||||||
unique_name_in_owner = true
|
|
||||||
position = Vector2( 160, 90 )
|
position = Vector2( 160, 90 )
|
||||||
current = true
|
current = true
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
class_name StaminaComponent
|
|
||||||
extends Node
|
|
||||||
|
|
||||||
export var max_stamina: int = 0
|
|
||||||
## Recovery Rate in units per second
|
|
||||||
export var recovery_rate: int = 0
|
|
||||||
onready var stamina :int = max_stamina
|
|
||||||
|
|
||||||
|
|
||||||
signal stamina_depleted()
|
|
||||||
|
|
||||||
var recovery_counter: float = 0
|
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
recovery_counter += delta
|
|
||||||
if recovery_rate != 0:
|
|
||||||
var _rate :float = 1.0/float(recovery_rate)
|
|
||||||
if recovery_counter > _rate: ## Divide by zero warning
|
|
||||||
recover(1)
|
|
||||||
recovery_counter = 0
|
|
||||||
|
|
||||||
func reduce_stamina(_amount :int):
|
|
||||||
if _amount < 0:
|
|
||||||
push_error("ERROR: Only positive numbers in stamina component functions.")
|
|
||||||
stamina -= _amount
|
|
||||||
|
|
||||||
if stamina <= 0:
|
|
||||||
emit_signal("stamina_depleted")
|
|
||||||
stamina = 0
|
|
||||||
|
|
||||||
func recover(recover_amount :int):
|
|
||||||
if recover_amount < 0:
|
|
||||||
push_error("ERROR: Only positive numbers in stamina component functions.")
|
|
||||||
return
|
|
||||||
stamina += recover_amount
|
|
||||||
|
|
||||||
if stamina > max_stamina:
|
|
||||||
stamina = max_stamina
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://lib/components/Stamina_Component.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="Stamina_Component" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/classes/state_machine.gd" type="Script" id=1]
|
[ext_resource path="res://lib/classes/animated_sprite_state_receiver.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://lib/classes/actor.gd" type="Script" id=2]
|
[ext_resource path="res://lib/classes/state_machine.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://lib/classes/movement_state_receiver.gd" type="Script" id=3]
|
[ext_resource path="res://lib/classes/audiostreamplayer_state_receiver.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://lib/classes/animated_sprite_state_receiver.gd" type="Script" id=4]
|
[ext_resource path="res://lib/classes/movement_state_receiver.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://lib/classes/audiostreamplayer_state_receiver.gd" type="Script" id=5]
|
[ext_resource path="res://lib/classes/actor.gd" type="Script" id=8]
|
||||||
|
|
||||||
[node name="Actor" type="KinematicBody2D"]
|
[node name="ActorTemplate" type="KinematicBody2D"]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 8 )
|
||||||
|
|
||||||
[node name="Movement_StateMachine" type="Node" parent="."]
|
[node name="Movement_StateMachine" type="Node" parent="."]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="AnimatedSprite_StateReceiver" type="AnimatedSprite" parent="."]
|
[node name="AnimatedSprite_StateReceiver" type="AnimatedSprite" parent="."]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_aseprite_wizard_config_": {
|
"_aseprite_wizard_config_": {
|
||||||
"layer": "",
|
"layer": "",
|
||||||
|
|
@ -31,9 +31,9 @@ __meta__ = {
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Movement_StateReceiver" type="Node" parent="."]
|
[node name="Movement_StateReceiver" type="Node" parent="."]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 5 )
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="AudioStreamPlayer_StateReceiver" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer_StateReceiver" type="AudioStreamPlayer" parent="."]
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 3 )
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
@ -104,11 +104,6 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/sound_effect_state_frame.gd"
|
"path": "res://lib/classes/sound_effect_state_frame.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Node",
|
|
||||||
"class": "StaminaComponent",
|
|
||||||
"language": "GDScript",
|
|
||||||
"path": "res://lib/components/Stamina_Component.gd"
|
|
||||||
}, {
|
|
||||||
"base": "Resource",
|
"base": "Resource",
|
||||||
"class": "State",
|
"class": "State",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
|
@ -164,7 +159,6 @@ _global_script_class_icons={
|
||||||
"Movement_StateReceiver": "",
|
"Movement_StateReceiver": "",
|
||||||
"Projectile": "",
|
"Projectile": "",
|
||||||
"SE_StateFrame": "",
|
"SE_StateFrame": "",
|
||||||
"StaminaComponent": "",
|
|
||||||
"State": "",
|
"State": "",
|
||||||
"StateAnimatedActor": "",
|
"StateAnimatedActor": "",
|
||||||
"StateMachine": "",
|
"StateMachine": "",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=116 format=2]
|
[gd_scene load_steps=116 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/actors/players/playerD/movement_component.gd" type="Script" id=2]
|
[ext_resource path="res://src/actors/players/playerD/movement_component.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://src/actors/players/playerD/Player.gd" type="Script" id=3]
|
[ext_resource path="res://src/actors/players/playerD/Player.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://lib/components/Health_Component.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://lib/components/Health_Component.tscn" type="PackedScene" id=7]
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
extends Movement_StateReceiver
|
extends Movement_StateReceiver
|
||||||
|
|
||||||
var parent_request_state_change :FuncRef
|
var parent_request_state_change :FuncRef
|
||||||
var parent_use_primary_item :FuncRef
|
|
||||||
|
|
||||||
var player_number: int = 1
|
var player_number: int = 1
|
||||||
|
|
||||||
onready var pew_machine = $"%PewMachine"
|
onready var pew_machine = $"%PewMachine"
|
||||||
onready var stamina_component = $"%Stamina_Component"
|
|
||||||
|
|
||||||
var state_stamina_cost :Dictionary
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var state_ref :State
|
var state_ref :State
|
||||||
|
|
@ -18,10 +14,6 @@ func _ready():
|
||||||
#TODO Should probably assert here or something.
|
#TODO Should probably assert here or something.
|
||||||
state_ref.connect("state_entered", self, "_on_state_entered_" + state_name)
|
state_ref.connect("state_entered", self, "_on_state_entered_" + state_name)
|
||||||
parent_request_state_change = funcref(get_node(callable_state_machine), 'check_parent_before_state_change')
|
parent_request_state_change = funcref(get_node(callable_state_machine), 'check_parent_before_state_change')
|
||||||
|
|
||||||
if parent.has_method("use_primary_item"):
|
|
||||||
parent_use_primary_item = funcref(parent, "use_primary_item")
|
|
||||||
|
|
||||||
# Lets see if this nutty thing works
|
# Lets see if this nutty thing works
|
||||||
# var state_ref :State = get_node(callable_state_machine).get_state_reference('idle')
|
# var state_ref :State = get_node(callable_state_machine).get_state_reference('idle')
|
||||||
# state_ref.connect("state_entered", self, "_on_state_entered_idle")
|
# state_ref.connect("state_entered", self, "_on_state_entered_idle")
|
||||||
|
|
@ -38,7 +30,7 @@ func get_movement_direction() -> float:
|
||||||
|
|
||||||
var _wants_jump :bool
|
var _wants_jump :bool
|
||||||
func wants_jump() -> bool:
|
func wants_jump() -> bool:
|
||||||
if Input.is_action_just_pressed("jump_" + str(player_number)) and stamina_component.stamina >= state_stamina_cost["jump"]:
|
if Input.is_action_just_pressed("jump_" + str(player_number)):
|
||||||
desired_movement_vector.y = UP
|
desired_movement_vector.y = UP
|
||||||
_wants_jump = true
|
_wants_jump = true
|
||||||
return true
|
return true
|
||||||
|
|
@ -85,11 +77,11 @@ func wants_dash() -> bool:
|
||||||
var _wants_roll :bool
|
var _wants_roll :bool
|
||||||
func wants_roll() -> bool:
|
func wants_roll() -> bool:
|
||||||
if Input.is_action_just_pressed("dash_" + str(player_number)) and Input.is_action_pressed("move_up_" + str(player_number)):
|
if Input.is_action_just_pressed("dash_" + str(player_number)) and Input.is_action_pressed("move_up_" + str(player_number)):
|
||||||
if parent.enough_stamina_for("roll"):
|
_wants_roll = true
|
||||||
_wants_roll = true
|
return true
|
||||||
return true
|
else:
|
||||||
_wants_roll = false
|
_wants_roll = false
|
||||||
return false
|
return false
|
||||||
|
|
||||||
var _wants_climb :bool
|
var _wants_climb :bool
|
||||||
func wants_climb() -> bool:
|
func wants_climb() -> bool:
|
||||||
|
|
@ -159,20 +151,15 @@ func _state_process_physics_idle():
|
||||||
|
|
||||||
func attack_primary():
|
func attack_primary():
|
||||||
##Another thing I wish I could avoid the funcref or string call
|
##Another thing I wish I could avoid the funcref or string call
|
||||||
# if get_parent().has_method("use_primary_item"):
|
if get_parent().has_method("primary_item"):
|
||||||
# var _item_state_name :String = get_parent().use_primary_item()
|
var _item_state_name :String = get_parent().primary_item()
|
||||||
# if _item_state_name != '':
|
|
||||||
# request_state_change.call_func(_item_state_name)
|
|
||||||
if parent_use_primary_item.is_valid():
|
|
||||||
var _item_state_name :String = parent_use_primary_item.call_func()
|
|
||||||
if _item_state_name != '':
|
if _item_state_name != '':
|
||||||
request_state_change.call_func(_item_state_name)
|
request_state_change.call_func(_item_state_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func attack_secondary():
|
func attack_secondary():
|
||||||
if get_parent().has_method("use_secondary_item"):
|
if get_parent().has_method("secondary_item"):
|
||||||
var _item_state_name :String = get_parent().use_secondary_item()
|
var _item_state_name :String = get_parent().secondary_item()
|
||||||
if _item_state_name != '':
|
if _item_state_name != '':
|
||||||
request_state_change.call_func(_item_state_name)
|
request_state_change.call_func(_item_state_name)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,47 +7,25 @@ export var player_number: int = 1
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
|
||||||
onready var player_inventory :InventoryManager = InventoryManager.new()
|
onready var player_inventory :InventoryManager = InventoryManager.new()
|
||||||
onready var stamina_component = $"%Stamina_Component"
|
|
||||||
onready var health_component = $"%Health_Component"
|
|
||||||
|
|
||||||
var punch_item :Item = preload("res://assets/items/punch.tres")
|
var punch_item :Item = preload("res://assets/items/punch.tres")
|
||||||
|
|
||||||
const state_stamina_cost :Dictionary = {
|
|
||||||
"jump": 10,
|
|
||||||
"attack_sword":20,
|
|
||||||
"attack_punch":10,
|
|
||||||
"roll":40,
|
|
||||||
"ledge_climb":10
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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
|
PlayerInfo.player_inventory = player_inventory
|
||||||
PlayerInfo.player_stamina = stamina_component.stamina
|
|
||||||
# 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(punch_item)
|
player_inventory.add_to_inventory(punch_item)
|
||||||
player_inventory.select_primary(punch_item)
|
player_inventory.select_primary(punch_item)
|
||||||
|
|
||||||
movement_component.state_stamina_cost = state_stamina_cost
|
|
||||||
|
|
||||||
|
|
||||||
#var stamina_recovery :float = 0.0
|
|
||||||
|
|
||||||
# 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):
|
||||||
PlayerInfo.player_position = global_position.round()
|
PlayerInfo.player_position = global_position.round()
|
||||||
# stamina_recovery += delta
|
|
||||||
# if stamina_recovery > 1.0:
|
|
||||||
# stamina_component.recover(1)
|
|
||||||
# stamina_recovery = 0.0
|
|
||||||
# #print("recover ", stamina_component.stamina)
|
|
||||||
|
|
||||||
PlayerInfo.player_stamina = stamina_component.stamina
|
|
||||||
|
|
||||||
|
|
||||||
match movement_state_machine.current_state.name:
|
match movement_state_machine.current_state.name:
|
||||||
"idle":
|
"idle":
|
||||||
if Input.is_action_just_released("switch_primary_item_" + str(player_number)):
|
if Input.is_action_just_released("switch_primary_item_" + str(player_number)):
|
||||||
|
|
@ -61,10 +39,10 @@ func _process(delta):
|
||||||
|
|
||||||
func hit_Receiver(damage):
|
func hit_Receiver(damage):
|
||||||
$Hurtbox_Component.set_hurtbox(false)
|
$Hurtbox_Component.set_hurtbox(false)
|
||||||
health_component.take_damage(damage)
|
$Health_Component.take_damage(damage)
|
||||||
if $Health_Component.health > 0:
|
if $Health_Component.health > 0:
|
||||||
movement_state_machine.change_to_known_state('hurt')
|
movement_state_machine.change_to_known_state('hurt')
|
||||||
PlayerInfo.player_health = health_component.health
|
PlayerInfo.player_health = $Health_Component.health
|
||||||
if PlayerInfo.player_health <= 0:
|
if PlayerInfo.player_health <= 0:
|
||||||
return
|
return
|
||||||
yield( get_tree().create_timer(2 + movement_state_machine.get_state_reference('hurt').timeout_seconds), "timeout")
|
yield( get_tree().create_timer(2 + movement_state_machine.get_state_reference('hurt').timeout_seconds), "timeout")
|
||||||
|
|
@ -92,15 +70,6 @@ func touch_the_thing(the_thing: Interactable) -> bool:
|
||||||
the_thing.trigger_interaction()
|
the_thing.trigger_interaction()
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func enough_stamina_for(_state_name :String) -> bool:
|
|
||||||
if state_stamina_cost.has(_state_name):
|
|
||||||
if stamina_component.stamina >= state_stamina_cost[_state_name]:
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
return false
|
|
||||||
## Return true by default because we don't have a cost for this move
|
|
||||||
return true
|
|
||||||
|
|
||||||
var state_to_item_map :Dictionary = {
|
var state_to_item_map :Dictionary = {
|
||||||
"sword": "attack_sword" ,
|
"sword": "attack_sword" ,
|
||||||
"gun": "attack_shoot",
|
"gun": "attack_shoot",
|
||||||
|
|
@ -109,7 +78,7 @@ var state_to_item_map :Dictionary = {
|
||||||
}
|
}
|
||||||
|
|
||||||
##TODO: We need to find a way to 'use' the item.
|
##TODO: We need to find a way to 'use' the item.
|
||||||
func use_primary_item() -> String:
|
func primary_item() -> String:
|
||||||
# if player_inventory.primary_selection.consumable == false:
|
# if player_inventory.primary_selection.consumable == false:
|
||||||
# if state_to_item_map.has(player_inventory.primary_selection.name):
|
# if state_to_item_map.has(player_inventory.primary_selection.name):
|
||||||
# player_inventory.remove_from_inventory(player_inventory.primary_selection)
|
# player_inventory.remove_from_inventory(player_inventory.primary_selection)
|
||||||
|
|
@ -118,32 +87,18 @@ func use_primary_item() -> String:
|
||||||
if player_inventory.primary_selection != null: # Have to make sure we even have a second
|
if player_inventory.primary_selection != null: # Have to make sure we even have a second
|
||||||
var _item_name :String = player_inventory.primary_selection.name
|
var _item_name :String = player_inventory.primary_selection.name
|
||||||
if state_to_item_map.has(_item_name):
|
if state_to_item_map.has(_item_name):
|
||||||
var state_name = state_to_item_map[_item_name]
|
|
||||||
## This item state has a cost associated with it.
|
|
||||||
if enough_stamina_for(state_name):
|
|
||||||
#print("Yup: ", state_stamina_cost[state_name], "<=", stamina_component.stamina)
|
|
||||||
player_inventory.remove_from_inventory(player_inventory.primary_selection)
|
|
||||||
return state_to_item_map[_item_name]
|
|
||||||
else:
|
|
||||||
## TODO: maybe some sort of 'fail' animation state
|
|
||||||
#print("Nope: ", state_stamina_cost[state_name], "<=", stamina_component.stamina)
|
|
||||||
return '' ## you can't use this
|
|
||||||
player_inventory.remove_from_inventory(player_inventory.primary_selection)
|
player_inventory.remove_from_inventory(player_inventory.primary_selection)
|
||||||
return state_to_item_map[_item_name]
|
return state_to_item_map[_item_name]
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
func use_secondary_item() -> String:
|
func secondary_item() -> String:
|
||||||
if player_inventory.secondary_selection != null: # Have to make sure we even have a second
|
if player_inventory.secondary_selection != null: # Have to make sure we even have a second
|
||||||
var _item_name :String = player_inventory.secondary_selection.name
|
var _item_name :String = player_inventory.secondary_selection.name
|
||||||
if state_to_item_map.has(_item_name):
|
if state_to_item_map.has(_item_name):
|
||||||
var state_name = state_to_item_map[_item_name]
|
player_inventory.remove_from_inventory(player_inventory.secondary_selection)
|
||||||
if enough_stamina_for(state_name):
|
return state_to_item_map[_item_name]
|
||||||
player_inventory.remove_from_inventory(player_inventory.secondary_selection)
|
|
||||||
return state_to_item_map[_item_name]
|
|
||||||
else:
|
|
||||||
## TODO: maybe some sort of 'fail' animation state
|
|
||||||
return ''
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
#func check_state_change(_new_state_name: String) -> bool:
|
#func check_state_change(_new_state_name: String) -> bool:
|
||||||
|
|
@ -156,10 +111,3 @@ func use_secondary_item() -> String:
|
||||||
# _: # None
|
# _: # None
|
||||||
# return true
|
# return true
|
||||||
# return true
|
# return true
|
||||||
|
|
||||||
|
|
||||||
func _on_Movement_StateMachine_state_changed(old_state_name, new_state):
|
|
||||||
# if new_state.name == "jump":
|
|
||||||
# stamina_component.reduce_stamina(state_stamina_cost["jump"])
|
|
||||||
if state_stamina_cost.has(new_state.name):
|
|
||||||
stamina_component.reduce_stamina(state_stamina_cost[new_state.name])
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=36 format=2]
|
[gd_scene load_steps=36 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE.gd" type="Script" id=3]
|
[ext_resource path="res://src/actors/players/playerE/PlayerE.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/idle.tres" type="Resource" id=4]
|
[ext_resource path="res://src/actors/players/playerE/states/idle.tres" type="Resource" id=4]
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25]
|
[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25]
|
||||||
[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26]
|
[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/attack_punch.tres" type="Resource" id=27]
|
[ext_resource path="res://src/actors/players/playerE/states/attack_punch.tres" type="Resource" id=27]
|
||||||
[ext_resource path="res://src/components/PewMachine.tscn" type="PackedScene" id=28]
|
[ext_resource path="res://src/PewMachine.gd" type="Script" id=28]
|
||||||
[ext_resource path="res://lib/components/Stamina_Component.tscn" type="PackedScene" id=29]
|
[ext_resource path="res://src/projectiles/MushroomPew.tscn" type="PackedScene" id=29]
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
|
|
@ -132,15 +132,9 @@ position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Health_Component" parent="." index="8" instance=ExtResource( 17 )]
|
[node name="Health_Component" parent="." index="8" instance=ExtResource( 17 )]
|
||||||
unique_name_in_owner = true
|
|
||||||
max_health = 100
|
max_health = 100
|
||||||
|
|
||||||
[node name="Stamina_Component" parent="." index="9" instance=ExtResource( 29 )]
|
[node name="Hurtbox_Component" parent="." index="9" instance=ExtResource( 16 )]
|
||||||
unique_name_in_owner = true
|
|
||||||
max_stamina = 50
|
|
||||||
recovery_rate = 12
|
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." index="10" instance=ExtResource( 16 )]
|
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 128
|
collision_mask = 128
|
||||||
hurtbox_entered_function = "hit_Receiver"
|
hurtbox_entered_function = "hit_Receiver"
|
||||||
|
|
@ -150,10 +144,12 @@ modulate = Color( 0, 0, 1, 1 )
|
||||||
position = Vector2( -1, 2 )
|
position = Vector2( -1, 2 )
|
||||||
shape = SubResource( 2 )
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
[node name="Interactable_Receiver" type="Node" parent="." index="11"]
|
[node name="Interactable_Receiver" type="Node" parent="." index="10"]
|
||||||
script = ExtResource( 21 )
|
script = ExtResource( 21 )
|
||||||
interactable_parent_callback = "touch_the_thing"
|
interactable_parent_callback = "touch_the_thing"
|
||||||
|
|
||||||
[node name="PewMachine" parent="." index="12" instance=ExtResource( 28 )]
|
[node name="PewMachine" type="Position2D" parent="." index="11"]
|
||||||
|
unique_name_in_owner = true
|
||||||
[connection signal="state_changed" from="Movement_StateMachine" to="." method="_on_Movement_StateMachine_state_changed"]
|
position = Vector2( 21, -7 )
|
||||||
|
script = ExtResource( 28 )
|
||||||
|
scene_path = ExtResource( 29 )
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
class_name Projectile
|
class_name Projectile
|
||||||
extends Area2D
|
extends Area2D
|
||||||
##TODO: Probably implement some sort of object pooling option
|
|
||||||
## so wen're not just deleting itself every timemout or screen exit.
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
|
||||||
export var velocity_pps :float = 1
|
export var velocity_pps :float = 1
|
||||||
export var lifespan :float = -1
|
|
||||||
var direction_normal := Vector2(0,0)
|
var direction_normal := Vector2(0,0)
|
||||||
|
|
||||||
var time_alive :float = 0.0
|
|
||||||
# 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.
|
||||||
|
|
@ -19,10 +16,6 @@ func _ready():
|
||||||
|
|
||||||
# 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 lifespan != -1:
|
|
||||||
time_alive += delta
|
|
||||||
if time_alive > lifespan:
|
|
||||||
queue_free()
|
|
||||||
rotate(delta * 10)
|
rotate(delta * 10)
|
||||||
position += direction_normal * velocity_pps * delta
|
position += direction_normal * velocity_pps * delta
|
||||||
|
|
||||||
|
|
@ -35,7 +28,3 @@ func _on_body_entered(body):
|
||||||
|
|
||||||
func _on_area_entered(area):
|
func _on_area_entered(area):
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
func _on_VisibilityNotifier2D_screen_exited():
|
|
||||||
queue_free()
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/components/PewMachine.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://src/projectiles/MushroomPew.tscn" type="PackedScene" id=2]
|
|
||||||
|
|
||||||
[node name="PewMachine" type="Position2D"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
position = Vector2( 21, -7 )
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
scene_path = ExtResource( 2 )
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/parent_scenes/projectile.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/projectile_template.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=2]
|
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=2]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id=1]
|
[sub_resource type="CapsuleShape2D" id=1]
|
||||||
|
|
@ -9,7 +9,6 @@ height = 2.0
|
||||||
|
|
||||||
[node name="MushroomPew" instance=ExtResource( 1 )]
|
[node name="MushroomPew" instance=ExtResource( 1 )]
|
||||||
velocity_pps = 300.0
|
velocity_pps = 300.0
|
||||||
lifespan = 0.5
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,9 @@
|
||||||
|
|
||||||
[ext_resource path="res://src/classes/projectile.gd" type="Script" id=1]
|
[ext_resource path="res://src/classes/projectile.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="Projectile" type="Area2D"]
|
[node name="Projectile_Template" type="Area2D"]
|
||||||
monitorable = false
|
monitorable = false
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
|
||||||
|
|
@ -16,8 +16,6 @@ onready var DialogIndicator = $PanelContainer/Polygon2D
|
||||||
|
|
||||||
onready var health_bar = $HealthBar
|
onready var health_bar = $HealthBar
|
||||||
|
|
||||||
onready var stamina_bar = $StaminaBar
|
|
||||||
|
|
||||||
## Cool I can bring this in with a ctrl drag
|
## Cool I can bring this in with a ctrl drag
|
||||||
onready var selected_inventory_items = $"%SelectedInventoryItems"
|
onready var selected_inventory_items = $"%SelectedInventoryItems"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=9 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]
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
[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]
|
[ext_resource path="res://src/ui/SelectedInventoryItems.gd" type="Script" id=8]
|
||||||
[ext_resource path="res://src/ui/StaminaBar.gd" type="Script" id=9]
|
|
||||||
|
|
||||||
[node name="HUD" type="CanvasLayer"]
|
[node name="HUD" type="CanvasLayer"]
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
|
|
@ -72,7 +71,7 @@ value = 50.0
|
||||||
texture_under = ExtResource( 4 )
|
texture_under = ExtResource( 4 )
|
||||||
texture_progress = ExtResource( 7 )
|
texture_progress = ExtResource( 7 )
|
||||||
texture_progress_offset = Vector2( 1, 1 )
|
texture_progress_offset = Vector2( 1, 1 )
|
||||||
script = ExtResource( 9 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="Debug" type="Label" parent="."]
|
[node name="Debug" type="Label" parent="."]
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user