spider stuff.

This commit is contained in:
Nitsud Yarg 2024-07-14 10:16:32 -07:00
parent 3e454f5785
commit 8106474b39
4 changed files with 69 additions and 3 deletions

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=12 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Actors/Enemies/Spider/spider_movement_component.gd" type="Script" id=3]
[sub_resource type="StreamTexture" id=1]
load_path = "res://.import/Spider1.png-85cc52177a93c8766bb76a39a26b9d70.stex"
@ -69,6 +70,9 @@ __meta__ = {
}
}
[node name="movement_component" parent="." index="1"]
script = ExtResource( 3 )
[node name="idle" parent="movement_state_machine" index="0"]
animation_sequence = [ "idle" ]
@ -83,9 +87,12 @@ position = Vector2( 0, -2 )
shape = SubResource( 7 )
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="." index="6"]
position = Vector2( 0, 1 )
[node name="Hurtbox_Component2" parent="." index="7" instance=ExtResource( 2 )]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox_Component2" index="0"]
modulate = Color( 1, 0, 0, 1 )
shape = SubResource( 8 )
[connection signal="screen_entered" from="VisibilityNotifier2D" to="movement_component" method="_on_VisibilityNotifier2D_screen_entered"]

View File

@ -0,0 +1,59 @@
extends MovementComponent
## Constants available to you
# UP = -1.0
# DOWN = 1.0
# LEFT = -1.0
# RIGHT = 1.0
# Avalable functions to call
# A Series of helper functions
# go_up():
# go_down():
# go_left():
# go_right():
# stop():
var entered_screen = false
var jump_var = false
func process(delta):
if entered_screen:
if current_movement_state == "idle":
jump_var = true
else:
jump_var = false
return
func wants_jump() -> bool:
return jump_var
## Other needed variables
# desired_movement_vector: Vector2 - Used to store desired movement depending on the state
# current_movement_state:String - The name of the current State
# Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player.
# velocity: Vector2 - Current velocity, you can change this at will but state may modify it
# Declare any other member variables here. Examples:
# var a = 2
# var b = "text"
# Called every frame. 'delta' is the elapsed time since the previous frame.
# you do not normally need to define this for Actor
#func process(delta):
# pass
# For Enemy and NPC Actors:
# should be called on the frame process.
# For Player Actors:
# Should be called on the input process
func _on_VisibilityNotifier2D_screen_entered():
entered_screen = true

View File

@ -36,7 +36,7 @@ extents = Vector2( 8, 53 )
script = ExtResource( 10 )
[node name="PlayerStart" type="Position2D" parent="."]
position = Vector2( 493, 291 )
position = Vector2( 316, 73 )
[node name="CameraBoundaries" type="Area2D" parent="."]
collision_layer = 256

View File

@ -133,7 +133,7 @@ actor_type = "Enemy"
position = Vector2( 11, -7 )
frames = SubResource( 20 )
animation = "idle"
frame = 1
frame = 2
__meta__ = {
"_aseprite_wizard_config_": {
"layer": "",