Setup project with player from previous work!

This commit is contained in:
Dustin 2025-03-08 22:07:24 -08:00
parent d6bfe92c00
commit 8fa6a6f370
24 changed files with 397 additions and 56 deletions

View File

@ -1,3 +1,22 @@
[gd_scene format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/actors/players/playerD/Player.tscn" type="PackedScene" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 208, 20 )
[node name="Main" type="Node2D"] [node name="Main" type="Node2D"]
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 147, 101 )
[node name="ColorRect" type="ColorRect" parent="."]
margin_top = 160.0
margin_right = 416.0
margin_bottom = 200.0
[node name="StaticBody2D" type="StaticBody2D" parent="ColorRect"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColorRect/StaticBody2D"]
position = Vector2( 208, 20 )
shape = SubResource( 1 )

BIN
assets/MManPortrait.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/MManPortrait.png-4e2ec0d6412baee3672a65d68519d9e1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/MManPortrait.png"
dest_files=[ "res://.import/MManPortrait.png-4e2ec0d6412baee3672a65d68519d9e1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/GenericReceiver.gd" type="Script" id=1] [ext_resource path="res://lib/components/GenericReceiver.gd" type="Script" id=1]
[node name="GenericReceiver" type="Node"] [node name="GenericReceiver" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/GenericSender.gd" type="Script" id=1] [ext_resource path="res://lib/components/GenericSender.gd" type="Script" id=1]
[node name="GenericSender" type="Area2D"] [node name="GenericSender" type="Area2D"]
collision_layer = 0 collision_layer = 0

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Health_Component.gd" type="Script" id=1] [ext_resource path="res://lib/components/Health_Component.gd" type="Script" id=1]
[node name="Health_Component" type="Node"] [node name="Health_Component" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Hitbox_Component.gd" type="Script" id=1] [ext_resource path="res://lib/components/Hitbox_Component.gd" type="Script" id=1]
[node name="Hitbox_Component" type="Area2D"] [node name="Hitbox_Component" type="Area2D"]
collision_layer = 128 collision_layer = 128

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Hurtbox_Component.gd" type="Script" id=1] [ext_resource path="res://lib/components/Hurtbox_Component.gd" type="Script" id=1]
[node name="Hurtbox_Component" type="Area2D"] [node name="Hurtbox_Component" type="Area2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Modifier_Component.gd" type="Script" id=1] [ext_resource path="res://lib/components/Modifier_Component.gd" type="Script" id=1]
[node name="Modifier_Component" type="Area2D"] [node name="Modifier_Component" type="Area2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Modifier_Receiver.gd" type="Script" id=1] [ext_resource path="res://lib/components/Modifier_Receiver.gd" type="Script" id=1]
[node name="Modifier_Receiver" type="Node2D"] [node name="Modifier_Receiver" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,13 +1,13 @@
[gd_scene load_steps=17 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1] [ext_resource path="res://lib/components/Hurtbox_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2] [ext_resource path="res://lib/classes/state_machine_animated_actor.gd" type="Script" id=2]
[ext_resource path="res://src/templates/Actor/states/fall.gd" type="Script" id=3] [ext_resource path="res://lib/templates/Actor/states/fall.gd" type="Script" id=3]
[ext_resource path="res://src/templates/Actor/states/idle.gd" type="Script" id=4] [ext_resource path="res://lib/templates/Actor/states/idle.gd" type="Script" id=4]
[ext_resource path="res://src/movement_component.gd" type="Script" id=5] [ext_resource path="res://src/classes/movement_component.gd" type="Script" id=5]
[ext_resource path="res://src/templates/Actor/resources/Smiley.png" type="Texture" id=6] [ext_resource path="res://lib/templates/Actor/resources/Smiley.png" type="Texture" id=6]
[ext_resource path="res://src/templates/Actor/states/move.gd" type="Script" id=7] [ext_resource path="res://lib/templates/Actor/states/move.gd" type="Script" id=7]
[ext_resource path="res://src/actor.gd" type="Script" id=8] [ext_resource path="res://lib/classes/actor.gd" type="Script" id=8]
[sub_resource type="AtlasTexture" id=76] [sub_resource type="AtlasTexture" id=76]
atlas = ExtResource( 6 ) atlas = ExtResource( 6 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.gd" type="Script" id=2] [ext_resource path="res://lib/templates/Interactable/Interactable_Component.gd" type="Script" id=2]
[node name="Interactable_Template" type="Area2D"] [node name="Interactable_Template" type="Area2D"]
script = ExtResource( 2 ) script = ExtResource( 2 )

View File

@ -24,6 +24,11 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://lib/components/Health_Component.gd" "path": "res://lib/components/Health_Component.gd"
}, { }, {
"base": "Interactable",
"class": "HealthPickup",
"language": "GDScript",
"path": "res://src/Interactables/HealthPickup.gd"
}, {
"base": "Area2D", "base": "Area2D",
"class": "Interactable", "class": "Interactable",
"language": "GDScript", "language": "GDScript",
@ -45,6 +50,11 @@ _global_script_classes=[ {
"path": "res://lib/components/Modifier_Receiver.gd" "path": "res://lib/components/Modifier_Receiver.gd"
}, { }, {
"base": "Node", "base": "Node",
"class": "MovementComponent",
"language": "GDScript",
"path": "res://src/classes/movement_component.gd"
}, {
"base": "Node",
"class": "State", "class": "State",
"language": "GDScript", "language": "GDScript",
"path": "res://lib/classes/state.gd" "path": "res://lib/classes/state.gd"
@ -73,10 +83,12 @@ _global_script_class_icons={
"Actor": "", "Actor": "",
"GitAPI": "", "GitAPI": "",
"HealthComponent": "", "HealthComponent": "",
"HealthPickup": "",
"Interactable": "", "Interactable": "",
"Interactable_Receiver": "", "Interactable_Receiver": "",
"ModifierProperties": "", "ModifierProperties": "",
"Modifier_Receiver": "", "Modifier_Receiver": "",
"MovementComponent": "",
"State": "", "State": "",
"StateAnimatedActor": "", "StateAnimatedActor": "",
"StateMachine": "", "StateMachine": "",
@ -100,9 +112,9 @@ animation/layers/only_include_visible_layers_by_default=true
[autoload] [autoload]
PlayerInfo="*res://src/singleton_autoloads/PlayerInfo.gd" PlayerInfo="*res://lib/singleton_autoloads/PlayerInfo.gd"
UiManager="*res://src/singleton_autoloads/UIManager.gd" UiManager="*res://lib/singleton_autoloads/UIManager.gd"
LevelInfo="*res://src/singleton_autoloads/LevelInfo.gd" LevelInfo="*res://lib/singleton_autoloads/LevelInfo.gd"
[debug] [debug]

View File

@ -0,0 +1,22 @@
extends Interactable
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var sprite: Sprite = $Sprite
const pickup = preload("res://src/Interactables/HealthPickup.tscn")
var opened := false
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
sprite.frame = 1
if !opened:
var chest_item = pickup.instance()
chest_item.global_position = global_position + Vector2(0,-50)
owner.add_child(chest_item)
opened = true

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Chest.gd" type="Script" id=2]
[ext_resource path="res://assets/High Forest/Assets/Interior-01.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
[node name="Chest" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="." index="0"]
texture = ExtResource( 3 )
vframes = 2
region_enabled = true
region_rect = Rect2( 49, 80, 30, 64 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0.0313726, 1, 0, 1 )
position = Vector2( 0, 3 )
shape = SubResource( 1 )

14
src/Interactables/Door.gd Normal file
View File

@ -0,0 +1,14 @@
extends Interactable
onready var door_animation: AnimatedSprite = $AnimatedSprite
func trigger_interaction():
door_animation.play("default")
yield( door_animation, "animation_finished")
$StaticBody2D/CollisionShape2D.disabled = true
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
pass

View File

@ -0,0 +1,68 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Door.gd" type="Script" id=2]
[ext_resource path="res://assets/mmz1_door.png" type="Texture" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
region = Rect2( 34, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 3 )
region = Rect2( 68, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 3 )
region = Rect2( 102, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 3 )
region = Rect2( 136, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 3 )
region = Rect2( 170, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 3 )
region = Rect2( 204, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 3 )
region = Rect2( 238, 0, 34, 94 )
[sub_resource type="SpriteFrames" id=9]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ],
"loop": false,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=10]
extents = Vector2( 40, 21 )
[sub_resource type="RectangleShape2D" id=11]
extents = Vector2( 19, 39 )
[node name="Door" instance=ExtResource( 1 )]
collision_layer = 0
collision_mask = 2
script = ExtResource( 2 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = SubResource( 9 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0, 1, 0.0392157, 1 )
shape = SubResource( 10 )
[node name="StaticBody2D" type="StaticBody2D" parent="." index="2"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" index="0"]
shape = SubResource( 11 )

View File

@ -0,0 +1,28 @@
class_name HealthPickup
extends Interactable
onready var health_icon: AnimatedSprite = $AnimatedSprite
onready var drop_raycast: RayCast2D = $RayCast2D
func _ready():
#gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
gravity = 90
# Doesn't get enabled until it drops
monitoring = false
func _physics_process(delta):
if drop_raycast.is_colliding() == false:
var velocity = Vector2(0,0)
position.y += delta * gravity
else:
monitoring = true
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
queue_free()

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Interactables/HealthPickup.gd" type="Script" id=1]
[ext_resource path="res://lib/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Interactables/QuickHealthPickup.tres" type="SpriteFrames" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 6.0
[node name="HealthPickup" instance=ExtResource( 2 )]
monitoring = false
script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = ExtResource( 3 )
frame = 2
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
shape = SubResource( 1 )
[node name="RayCast2D" type="RayCast2D" parent="." index="2"]
enabled = true
cast_to = Vector2( 0, 8 )
collision_mask = 3

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://assets/quick_health.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 15, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 30, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 45, 0, 15, 13 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]

View File

@ -4,12 +4,15 @@ export var player_number: int = 1
onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D
onready var gun = $Gun # Removing gun for now
#onready var gun = $Gun
func _ready() -> void: func _ready() -> void:
PlayerInfo.player_health = $Health_Component.health PlayerInfo.player_health = $Health_Component.health
global_position = LevelInfo.player_start_position.transform.origin
# Disabled for testing
#global_position = LevelInfo.player_start_position.transform.origin
movement_component.player_number = player_number movement_component.player_number = player_number
@ -49,7 +52,8 @@ func touch_the_thing(the_thing: Interactable) -> bool:
func _on_attack_do_attack(): func _on_attack_do_attack():
var is_shooting = false var is_shooting = false
print("Direction: ", transform.x.x) print("Direction: ", transform.x.x)
is_shooting = gun.shoot(int(transform.x.x)) # Gun removed for now
#is_shooting = gun.shoot(int(transform.x.x))

View File

@ -1,27 +1,27 @@
[gd_scene load_steps=127 format=2] [gd_scene load_steps=126 format=2]
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://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://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://actors/players/playerD/states/idle.gd" type="Script" id=4] [ext_resource path="res://src/actors/players/playerD/states/idle.gd" type="Script" id=4]
[ext_resource path="res://actors/players/playerD/states/move.gd" type="Script" id=5] [ext_resource path="res://src/actors/players/playerD/states/move.gd" type="Script" id=5]
[ext_resource path="res://actors/players/playerD/states/fall.gd" type="Script" id=6] [ext_resource path="res://src/actors/players/playerD/states/fall.gd" type="Script" id=6]
[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]
[ext_resource path="res://actors/players/playerD/states/jump.gd" type="Script" id=8] [ext_resource path="res://src/actors/players/playerD/states/jump.gd" type="Script" id=8]
[ext_resource path="res://lib/components/Modifier_Receiver.tscn" type="PackedScene" id=9] [ext_resource path="res://lib/components/Modifier_Receiver.tscn" type="PackedScene" id=9]
[ext_resource path="res://actors/players/playerD/states/attack.gd" type="Script" id=10] [ext_resource path="res://src/actors/players/playerD/states/attack.gd" type="Script" id=10]
[ext_resource path="res://actors/players/playerD/states/dash.gd" type="Script" id=11] [ext_resource path="res://src/actors/players/playerD/states/dash.gd" type="Script" id=11]
[ext_resource path="res://actors/players/playerD/states/hurt.gd" type="Script" id=12] [ext_resource path="res://src/actors/players/playerD/states/hurt.gd" type="Script" id=12]
[ext_resource path="res://actors/players/playerD/states/roll.gd" type="Script" id=14] [ext_resource path="res://src/actors/players/playerD/states/roll.gd" type="Script" id=14]
[ext_resource path="res://actors/players/playerD/states/die.gd" type="Script" id=15] [ext_resource path="res://src/actors/players/playerD/states/die.gd" type="Script" id=15]
[ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=16] [ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=16]
[ext_resource path="res://actors/players/playerD/states/climb.gd" type="Script" id=17] [ext_resource path="res://src/actors/players/playerD/states/climb.gd" type="Script" id=17]
[sub_resource type="RectangleShape2D" id=197] [sub_resource type="RectangleShape2D" id=197]
extents = Vector2( 13, 18.5 ) extents = Vector2( 13, 18.5 )
[sub_resource type="StreamTexture" id=90] [sub_resource type="StreamTexture" id=90]
load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex" load_path = "res://.import/Mega.png-398a010e8e27ac84fe3335706e03da1e.stex"
[sub_resource type="AtlasTexture" id=91] [sub_resource type="AtlasTexture" id=91]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
@ -557,7 +557,6 @@ shape = SubResource( 197 )
position = Vector2( -1, -51 ) position = Vector2( -1, -51 )
frames = SubResource( 196 ) frames = SubResource( 196 )
animation = "idle_shoot" animation = "idle_shoot"
frame = 0
flip_h = false flip_h = false
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
@ -672,30 +671,15 @@ shape = SubResource( 89 )
[node name="Health_Component" parent="." index="6" instance=ExtResource( 7 )] [node name="Health_Component" parent="." index="6" instance=ExtResource( 7 )]
max_health = 100 max_health = 100
[node name="Gun" type="Position2D" parent="." index="7"] [node name="Interactable_Receiver" type="Node2D" parent="." index="7"]
physics_interpolation_mode = 1
position = Vector2( 23, -9 )
script = ExtResource( 13 )
[node name="Cooldown" type="Timer" parent="Gun" index="0"]
wait_time = 0.5
one_shot = true
[node name="Line2D" type="Line2D" parent="Gun" index="1"]
position = Vector2( -3, 0 )
points = PoolVector2Array( -5, 0, 1.25483, 0, 5, 0 )
width = 2.0
default_color = Color( 1, 0.607843, 0, 1 )
[node name="Interactable_Receiver" type="Node2D" parent="." index="8"]
script = ExtResource( 16 ) script = ExtResource( 16 )
interactable_parent_callback = "touch_the_thing" interactable_parent_callback = "touch_the_thing"
[node name="Modifier_Receiver" parent="." index="9" instance=ExtResource( 9 )] [node name="Modifier_Receiver" parent="." index="8" instance=ExtResource( 9 )]
modifier_parent_callback = "receive_modifier" modifier_parent_callback = "receive_modifier"
debug_receiver = true debug_receiver = true
[node name="Ladder_Detection" type="RayCast2D" parent="." index="10"] [node name="Ladder_Detection" type="RayCast2D" parent="." index="9"]
modulate = Color( 0.247059, 0.92549, 0.0313726, 1 ) modulate = Color( 0.247059, 0.92549, 0.0313726, 1 )
position = Vector2( 0, 5 ) position = Vector2( 0, 5 )
enabled = true enabled = true

View File

@ -0,0 +1,82 @@
class_name MovementComponent
extends Node
## Movement component
# attempts to interact with movement of the scene root without knowing what
# it is. It can be perhaps a static body or kinematicbody
# it doesn't actually move a node, that's what the state machine does
# but it does keep track of velocity
# I can't give it an actor node or a direct reference.
# It can use a number of detection components to help inform decisions.
export var debug_component: bool = false
onready var desired_movement_vector: Vector2 = Vector2(0,0)
var current_movement_state:String
# Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player.
var velocity = Vector2(0,0)
var momentum = Vector2(0,0)
var acceleration = Vector2(0,0)
var sim_velocity = Vector2(0,0)
#Can't use floats here, switched to constants.
#enum directions {UP = -1, DOWN = 1, LEFT, RIGHT}
var attack_function: FuncRef
const UP = -1.0
const DOWN = 1.0
const LEFT = -1.0
const RIGHT = 1.0
func process_physics(delta):
pass
func process(delta):
pass
func process_input(event: InputEvent):
pass
# A Series of helper functions
func go_up():
desired_movement_vector.y = UP
func go_down():
desired_movement_vector.y = DOWN
func go_left():
desired_movement_vector.x = LEFT
func go_right():
desired_movement_vector.x = RIGHT
func stop():
desired_movement_vector = Vector2(0,0)
# Return the desired direction of movement for the character
# in the range [-1, 1], where positive values indicate a desire
# to move to the right and negative values to the left.
func get_movement_direction() -> float:
return desired_movement_vector.x
# Return a boolean indicating if the character wants to jump
func wants_jump() -> bool:
return false
# Return a boolean indicating if the character wants to attack
func wants_shoot() -> bool:
return false
# Return a boolean indicating if the character wants to dash
func wants_dash() -> bool:
return false
func wants_roll() -> bool:
return false
func wants_climb() -> bool:
return false
func get_climb_shape_location() -> Vector2:
return Vector2(-1,-1)