Compare commits
No commits in common. "7acdc7633c4f1455e14d932d93bc62f3ec7de4e6" and "f67fdbbe3ef758881b26b970bbda52f61d54db38" have entirely different histories.
7acdc7633c
...
f67fdbbe3e
|
|
@ -1,54 +0,0 @@
|
||||||
class_name CollisionShape2D_StateReceiver
|
|
||||||
extends CollisionShape2D
|
|
||||||
|
|
||||||
## Standard vars for state receivers
|
|
||||||
export var debug_component: bool = false
|
|
||||||
export var callable_state_machine :NodePath
|
|
||||||
var request_state_change: FuncRef
|
|
||||||
onready var current_state :StateAnimatedActor
|
|
||||||
|
|
||||||
## return to default when no state function
|
|
||||||
export var default_shape_when_no_state_function :bool = true
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
var default_shape :Shape2D
|
|
||||||
var default_transform :Transform2D
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
## Standard ready routines for state receivers
|
|
||||||
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
|
||||||
## Connect signal to get alerted of state change
|
|
||||||
get_node(callable_state_machine).connect("state_changed", self,"_on_state_change")
|
|
||||||
## A reference to the current state machine state
|
|
||||||
current_state = get_node(callable_state_machine).current_state
|
|
||||||
|
|
||||||
default_shape = shape.duplicate()
|
|
||||||
##TODO: Are transforms primitives? Do they get passed by value?
|
|
||||||
default_transform = transform
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
## Standard function for receiving state change
|
|
||||||
func _on_state_change(old_state_name:String, new_state :State):
|
|
||||||
###### State machine
|
|
||||||
if new_state is StateAnimatedActor: #Testing this. Update: It works
|
|
||||||
current_state = new_state
|
|
||||||
if has_method('_on_state_change_' + current_state.name):
|
|
||||||
call('_on_state_change_' + current_state.name)
|
|
||||||
else:
|
|
||||||
if default_shape_when_no_state_function:
|
|
||||||
if debug_component:
|
|
||||||
print ("Returning to default collision shape")
|
|
||||||
shape = default_shape
|
|
||||||
transform = default_transform
|
|
||||||
else:
|
|
||||||
push_warning("Received non animated Actor state.")
|
|
||||||
|
|
||||||
|
|
@ -29,11 +29,6 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://src/classes/camera_guide.gd"
|
"path": "res://src/classes/camera_guide.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "CollisionShape2D",
|
|
||||||
"class": "CollisionShape2D_StateReceiver",
|
|
||||||
"language": "GDScript",
|
|
||||||
"path": "res://lib/classes/collision_shape2D_state_receiver.gd"
|
|
||||||
}, {
|
|
||||||
"base": "",
|
"base": "",
|
||||||
"class": "GitAPI",
|
"class": "GitAPI",
|
||||||
"language": "NativeScript",
|
"language": "NativeScript",
|
||||||
|
|
@ -159,7 +154,6 @@ _global_script_class_icons={
|
||||||
"AnimatedSprite_StateReceiver": "",
|
"AnimatedSprite_StateReceiver": "",
|
||||||
"AudioStreamPlayer_StateReceiver": "",
|
"AudioStreamPlayer_StateReceiver": "",
|
||||||
"CameraGuide": "",
|
"CameraGuide": "",
|
||||||
"CollisionShape2D_StateReceiver": "",
|
|
||||||
"GitAPI": "",
|
"GitAPI": "",
|
||||||
"HealthComponent": "",
|
"HealthComponent": "",
|
||||||
"HealthPickup": "",
|
"HealthPickup": "",
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
extends CollisionShape2D_StateReceiver
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
func _on_state_change_hurt():
|
|
||||||
print ("<---- Hey you called me to get hurt. Bruh.")
|
|
||||||
transform = transform.translated(Vector2(-10,10))
|
|
||||||
pass
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=38 format=2]
|
[gd_scene load_steps=37 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/parent_scenes/actor.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]
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
[ext_resource path="res://src/components/PewMachine.tscn" type="PackedScene" id=28]
|
[ext_resource path="res://src/components/PewMachine.tscn" type="PackedScene" id=28]
|
||||||
[ext_resource path="res://lib/components/Stamina_Component.tscn" type="PackedScene" id=29]
|
[ext_resource path="res://lib/components/Stamina_Component.tscn" type="PackedScene" id=29]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/death.tres" type="Resource" id=30]
|
[ext_resource path="res://src/actors/players/playerE/states/death.tres" type="Resource" id=30]
|
||||||
[ext_resource path="res://src/actors/players/playerE/PlayerE-CollisionShape2D_StateReceiver.gd" type="Script" id=31]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
|
|
@ -132,9 +131,6 @@ sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"]
|
||||||
position = Vector2( 0, 2 )
|
position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
script = ExtResource( 31 )
|
|
||||||
debug_component = true
|
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
|
||||||
|
|
||||||
[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
|
unique_name_in_owner = true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user