Even more changes.
This commit is contained in:
Executable → Regular
+1
-1
@@ -35,5 +35,5 @@ func _on_body_entered(body: Node2D) -> void:
|
||||
global.goto_scene(load(TargetRoomPath))
|
||||
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
func _on_body_exited(_body: Node2D) -> void:
|
||||
global.player_target = ""
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+6
-1
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=28 format=3 uid="uid://enj7slqj7o2o"]
|
||||
[gd_scene load_steps=29 format=3 uid="uid://enj7slqj7o2o"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c8v7mt7kbv7k5" path="res://objects/npcs/zombie.png" id="1_8psf6"]
|
||||
[ext_resource type="Script" uid="uid://bw8t7n771m0b4" path="res://objects/npcs/zombie.gd" id="1_qml1x"]
|
||||
[ext_resource type="Script" uid="uid://bsveyr6o3li86" path="res://objects/npcs/zombie_sprite.gd" id="3_8bxsl"]
|
||||
[ext_resource type="Script" uid="uid://e6q7q0ljb34u" path="res://scripts/state_collision.gd" id="4_8svax"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qml1x"]
|
||||
atlas = ExtResource("1_8psf6")
|
||||
@@ -201,3 +202,7 @@ shape = SubResource("CapsuleShape2D_8psf6")
|
||||
position = Vector2(10, -11.5)
|
||||
shape = SubResource("RectangleShape2D_8bxsl")
|
||||
debug_color = Color(0.9942227, 0, 0.23271917, 0.41960785)
|
||||
|
||||
[node name="CollisionState2D" type="CollisionShape2D" parent="Area2D"]
|
||||
script = ExtResource("4_8svax")
|
||||
metadata/_custom_type_script = "uid://e6q7q0ljb34u"
|
||||
|
||||
Executable → Regular
+1
-1
@@ -7,5 +7,5 @@ func _ready() -> void:
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
Binary file not shown.
Executable → Regular
+38
-32
@@ -6,15 +6,24 @@ extends CharacterBody2D
|
||||
|
||||
signal state_change(old: States, new: States)
|
||||
|
||||
enum States {IDLE, RUN_START, RUN, ROLL, JUMP_START, JUMP, FALL, LAND, DAMAGE, RAGDOLL, BOUNCE, LAY, SHOOT, JAB, STRAIGHT, KICK, POUND}
|
||||
enum States {NULL, IDLE, RUN_START, RUN, ROLL, JUMP_START, JUMP, FALL, LAND, DAMAGE, RAGDOLL, BOUNCE, LAY, SHOOT, JAB, STRAIGHT, KICK, POUND, POUND_FALL}
|
||||
|
||||
const STATES_IMMOBILE = [States.ROLL, States.DAMAGE, States.RAGDOLL, States.BOUNCE, States.LAY, States.SHOOT, States.JAB, States.STRAIGHT, States.KICK, States.POUND]
|
||||
const STATES_IMMOBILE = [States.ROLL, States.DAMAGE, States.RAGDOLL, States.BOUNCE, States.LAY, States.SHOOT, States.JAB, States.STRAIGHT, States.KICK, States.POUND, States.POUND_FALL]
|
||||
const STATES_MOVEMENT = [States.RUN_START, States.RUN, States.JUMP_START, States.JUMP, States.FALL]
|
||||
const STATES_ATTACK = [States.JAB, States.STRAIGHT, States.KICK, States.POUND]
|
||||
const STATES_AIRBORNE = [States.JUMP_START, States.JUMP, States.FALL]
|
||||
|
||||
# FX
|
||||
const ROLL_DUST = preload("uid://botc600n5fcgt")
|
||||
const JUMP_DUST = preload("uid://c4h1cj75b5sry")
|
||||
|
||||
# Sounds
|
||||
const JUMP_SOUND = preload("uid://d1hwunwdel6sy")
|
||||
const HIT_GROUND = preload("uid://ciglwfq0vua8i")
|
||||
const POUND_SOUND = preload("uid://css0nv2dxb52w")
|
||||
|
||||
# Projectiles
|
||||
const POUND_BULLET = preload("uid://5uiinhmeyov0")
|
||||
|
||||
const SPEED = 90.0
|
||||
const ACCEL = 450
|
||||
@@ -22,20 +31,9 @@ const JUMP_VELOCITY = -312.0
|
||||
const ROLL_VELOCITY = 150.0
|
||||
const ROLL_DECEL = 1080
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
var state: States = States.IDLE: set = _set_state
|
||||
|
||||
var state_buffer: States = States.NULL
|
||||
var direction: float
|
||||
var grounded: bool
|
||||
var running: bool
|
||||
var rolling: bool
|
||||
var ragdoll: bool
|
||||
var bounce: bool
|
||||
var lay: bool
|
||||
var shooting: bool
|
||||
var melee: bool
|
||||
|
||||
func _set_state(s: States):
|
||||
state_change.emit(state, s)
|
||||
@@ -47,7 +45,7 @@ func _process(_delta: float) -> void:
|
||||
func _physics_process(delta):
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity.y += gravity * delta
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Jumping
|
||||
if state not in STATES_IMMOBILE and state not in STATES_AIRBORNE and Input.is_action_just_pressed("jump") and is_on_floor():
|
||||
@@ -61,16 +59,17 @@ func _physics_process(delta):
|
||||
add_sibling(jump_dust)
|
||||
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
|
||||
# Short hops
|
||||
if Input.is_action_just_released("jump") && !is_on_floor():
|
||||
if state in [States.JUMP_START, States.JUMP] and Input.is_action_just_released("jump") and !is_on_floor():
|
||||
velocity.y = velocity.y / 2
|
||||
|
||||
# Falling
|
||||
if state not in [States.ROLL, States.RAGDOLL, States.BOUNCE] and velocity.y > 0:
|
||||
if state in [States.IDLE] + STATES_MOVEMENT and velocity.y > 0:
|
||||
state = States.FALL
|
||||
|
||||
if state in [States.FALL] and is_zero_approx(velocity.y):
|
||||
# Landing
|
||||
if state in [States.FALL] and is_on_floor():
|
||||
if direction:
|
||||
state = States.RUN
|
||||
else:
|
||||
@@ -78,7 +77,7 @@ func _physics_process(delta):
|
||||
|
||||
# Rolls
|
||||
if state not in STATES_IMMOBILE and state != States.ROLL and \
|
||||
(Input.is_action_just_pressed("roll_jump") or Input.is_action_just_pressed("roll")):
|
||||
(Input.is_action_just_pressed("roll_jump") or (Input.is_action_just_pressed("roll") and direction)):
|
||||
state = States.ROLL
|
||||
|
||||
if is_on_floor():
|
||||
@@ -94,20 +93,27 @@ func _physics_process(delta):
|
||||
|
||||
if velocity.y >= 0 && Input.is_action_just_pressed("roll_jump"):
|
||||
velocity.y = -120
|
||||
|
||||
|
||||
# Melee
|
||||
if state not in STATES_IMMOBILE and Input.is_action_just_pressed("melee"):
|
||||
state = States.MELEE
|
||||
if Input.is_action_pressed("roll"):
|
||||
# Pound
|
||||
pass
|
||||
state = States.POUND
|
||||
velocity.x = 0
|
||||
elif state in STATES_AIRBORNE:
|
||||
state = States.KICK
|
||||
else:
|
||||
state = States.JAB
|
||||
|
||||
# Pound
|
||||
if state in [States.POUND_FALL] and is_on_floor():
|
||||
state = States.POUND
|
||||
|
||||
# Shooting
|
||||
if state not in STATES_IMMOBILE and Input.is_action_just_pressed("shoot"):
|
||||
state = States.SHOOT
|
||||
match global.save.projectile:
|
||||
global.save.Projectile.BLAST:
|
||||
pass
|
||||
#if state not in STATES_IMMOBILE and Input.is_action_just_pressed("shoot"):
|
||||
#state = States.SHOOT
|
||||
#match global.save.projectile:
|
||||
#global.save.Projectile.BLAST:
|
||||
#pass
|
||||
|
||||
# Ragdoll
|
||||
if state not in [States.RAGDOLL, States.BOUNCE, States.LAY] and Input.is_action_just_pressed("ragdoll"):
|
||||
@@ -139,14 +145,14 @@ func _physics_process(delta):
|
||||
if state == States.ROLL and sprite.frame > 7:
|
||||
# Slow down if in the later roll frames.
|
||||
velocity.x = move_toward(velocity.x, 0, ROLL_DECEL * delta)
|
||||
elif state not in [States.ROLL, States.DAMAGE, States.RAGDOLL, States.BOUNCE, States.LAY, States.SHOOT, States.MELEE]:
|
||||
elif state not in STATES_IMMOBILE:
|
||||
# Apply velocity changes if not in a restricted movement state.
|
||||
velocity.x = move_toward(velocity.x, direction * SPEED, ACCEL * delta)
|
||||
if direction:
|
||||
if state not in [States.JUMP_START, States.JUMP, States.FALL, States.RUN_START, States.RUN]:
|
||||
if state not in STATES_MOVEMENT:
|
||||
state = States.RUN_START
|
||||
else:
|
||||
if state not in [States.JUMP_START, States.JUMP, States.FALL, States.LAND]:
|
||||
if state not in (STATES_AIRBORNE + [States.LAND]):
|
||||
state = States.IDLE
|
||||
|
||||
move_and_slide()
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 31 KiB |
Executable → Regular
Executable → Regular
+138
-72
@@ -1,38 +1,9 @@
|
||||
[gd_scene load_steps=88 format=3 uid="uid://2f3x4fcr0os6"]
|
||||
[gd_scene load_steps=93 format=3 uid="uid://2f3x4fcr0os6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ci24lybfsaxd0" path="res://objects/player.png" id="1_2mhpo"]
|
||||
[ext_resource type="Script" uid="uid://drpdjfp0o7bbv" path="res://objects/player.gd" id="1_c7kgv"]
|
||||
[ext_resource type="Script" uid="uid://e6q7q0ljb34u" path="res://scripts/state_collision.gd" id="1_uxov2"]
|
||||
[ext_resource type="Script" uid="uid://cgeaq15vi0bnd" path="res://objects/player_sprite.gd" id="3_uxov2"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ykyjo"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uxov2"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(35, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nmc1l"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(70, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f46kd"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(105, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3rerk"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(140, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i825w"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(175, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3rfka"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(210, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i8sra"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 344, 35, 43)
|
||||
@@ -121,6 +92,34 @@ region = Rect2(0, 215, 35, 43)
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 172, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nmc1l"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f46kd"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(35, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3rerk"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(70, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i825w"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(105, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3rfka"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(140, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_egsjp"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(175, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vvqst"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(210, 645, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6ypbn"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 387, 35, 43)
|
||||
@@ -197,6 +196,10 @@ region = Rect2(175, 559, 35, 43)
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(210, 559, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8te8c"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 602, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r7a5p"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 129, 35, 43)
|
||||
@@ -293,6 +296,30 @@ region = Rect2(140, 43, 35, 43)
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(175, 43, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_le5ai"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 688, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f0uyi"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(35, 688, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0wtkl"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(70, 688, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_78ip1"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(105, 688, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_syu46"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 731, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_urgsq"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(35, 731, 35, 43)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_p2pxn"]
|
||||
atlas = ExtResource("1_2mhpo")
|
||||
region = Rect2(0, 516, 35, 43)
|
||||
@@ -325,32 +352,6 @@ region = Rect2(210, 516, 35, 43)
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ykyjo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uxov2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nmc1l")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f46kd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3rerk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i825w")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3rfka")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"air_kick",
|
||||
"speed": 24.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i8sra")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -447,6 +448,32 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nmc1l")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f46kd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3rerk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i825w")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3rfka")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_egsjp")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vvqst")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"kick",
|
||||
"speed": 24.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6ypbn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -517,6 +544,18 @@ animations = [{
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4g3oa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4g3oa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4g3oa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4g3oa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4g3oa")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"pound",
|
||||
@@ -524,6 +563,14 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8te8c")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"pound_fall",
|
||||
"speed": 18.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r7a5p")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -611,6 +658,34 @@ animations = [{
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_le5ai")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f0uyi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0wtkl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_78ip1")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"shoot",
|
||||
"speed": 30.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_syu46")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_urgsq")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"shoot_shuffle",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_p2pxn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -636,9 +711,9 @@ animations = [{
|
||||
"speed": 24.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_f46kd"]
|
||||
radius = 8.0
|
||||
height = 16.0
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_nmc1l"]
|
||||
radius = 6.0
|
||||
height = 22.0
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_uxov2"]
|
||||
script/source = "extends CollisionState2D
|
||||
@@ -647,10 +722,6 @@ func _on_player_state_change(_old: Player.States, new: Player.States) -> void:
|
||||
change_shape(Player.States.keys()[new])
|
||||
"
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_nmc1l"]
|
||||
radius = 6.0
|
||||
height = 22.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
z_index = 10
|
||||
floor_constant_speed = true
|
||||
@@ -663,14 +734,13 @@ max_polyphony = 2
|
||||
[node name="Sprite" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -11)
|
||||
sprite_frames = SubResource("SpriteFrames_blchw")
|
||||
animation = &"roll"
|
||||
frame = 4
|
||||
animation = &"pound"
|
||||
offset = Vector2(0, -0.5)
|
||||
script = ExtResource("3_uxov2")
|
||||
|
||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -11)
|
||||
shape = SubResource("CapsuleShape2D_f46kd")
|
||||
shape = SubResource("CapsuleShape2D_nmc1l")
|
||||
script = SubResource("GDScript_uxov2")
|
||||
Shapes = Dictionary[String, Shape2D]({
|
||||
"IDLE": SubResource("CapsuleShape2D_nmc1l")
|
||||
@@ -683,11 +753,7 @@ offset_top = -56.0
|
||||
offset_right = 40.0
|
||||
offset_bottom = -24.0
|
||||
|
||||
[node name="Attackbox" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionState2D" type="CollisionShape2D" parent="Attackbox"]
|
||||
script = ExtResource("1_uxov2")
|
||||
metadata/_custom_type_script = "uid://e6q7q0ljb34u"
|
||||
|
||||
[connection signal="state_change" from="." to="Sprite" method="_on_player_state_change"]
|
||||
[connection signal="state_change" from="." to="Hitbox" method="_on_player_state_change"]
|
||||
[connection signal="animation_finished" from="Sprite" to="Sprite" method="_on_animation_finished"]
|
||||
[connection signal="frame_changed" from="Sprite" to="Sprite" method="_on_frame_changed"]
|
||||
|
||||
Executable → Regular
+27
-10
@@ -7,10 +7,12 @@ extends AnimatedSprite2D
|
||||
func _ready():
|
||||
play("default")
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
match player.state:
|
||||
if player.direction and player.state not in Player.STATES_IMMOBILE:
|
||||
flip_h = player.direction < 0
|
||||
|
||||
func _on_player_state_change(old: Player.States, new: Player.States) -> void:
|
||||
match new:
|
||||
Player.States.IDLE:
|
||||
play("default")
|
||||
Player.States.RUN_START:
|
||||
@@ -37,18 +39,33 @@ func _process(_delta):
|
||||
frame = 4
|
||||
Player.States.LAY:
|
||||
play("lay")
|
||||
if player.direction:
|
||||
flip_h = player.direction < 0
|
||||
Player.States.POUND:
|
||||
play("pound")
|
||||
if old == Player.States.POUND_FALL:
|
||||
frame = 4
|
||||
Player.States.POUND_FALL:
|
||||
play("pound_fall")
|
||||
Player.States.KICK:
|
||||
play("kick")
|
||||
|
||||
func _on_animation_finished():
|
||||
match animation:
|
||||
"run_start":
|
||||
player.state = Player.States.RUN
|
||||
"land":
|
||||
player.state = Player.States.IDLE
|
||||
"jump_start":
|
||||
player.state = Player.States.JUMP
|
||||
"roll":
|
||||
player.state = Player.States.IDLE
|
||||
"damage":
|
||||
"land", "roll", "damage", "pound", "kick":
|
||||
player.state = Player.States.IDLE
|
||||
|
||||
func _on_frame_changed() -> void:
|
||||
match animation:
|
||||
"pound" when frame == 3 and !player.is_on_floor():
|
||||
player.state = Player.States.POUND_FALL
|
||||
"pound" when frame == 5:
|
||||
player.audio_player.stream = player.POUND_SOUND
|
||||
player.audio_player.play()
|
||||
|
||||
var pound_bullet = player.POUND_BULLET.instantiate()
|
||||
pound_bullet.position = player.position
|
||||
pound_bullet.flip_h = !flip_h
|
||||
player.add_sibling(pound_bullet)
|
||||
|
||||
Executable → Regular
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d4eg0ukm83711"
|
||||
path="res://.godot/imported/pound.png-6ee6ac380bf754456c2cc079349b4d65.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://objects/projectiles/pound.png"
|
||||
dest_files=["res://.godot/imported/pound.png-6ee6ac380bf754456c2cc079349b4d65.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,4 @@
|
||||
extends AnimatedSprite2D
|
||||
|
||||
func _on_animation_finished() -> void:
|
||||
queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bjevl3d4tu3e8
|
||||
@@ -0,0 +1,43 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://5uiinhmeyov0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjevl3d4tu3e8" path="res://objects/projectiles/pound_bullet.gd" id="1_3ik7t"]
|
||||
[ext_resource type="Texture2D" uid="uid://d4eg0ukm83711" path="res://objects/projectiles/pound.png" id="1_x3ryp"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3ik7t"]
|
||||
atlas = ExtResource("1_x3ryp")
|
||||
region = Rect2(0, 0, 48, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g7yrk"]
|
||||
atlas = ExtResource("1_x3ryp")
|
||||
region = Rect2(48, 0, 48, 64)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_i8330"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3ik7t")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g7yrk")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"default",
|
||||
"speed": 36.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3ik7t"]
|
||||
size = Vector2(22, 7)
|
||||
|
||||
[node name="PoundBullet" type="AnimatedSprite2D"]
|
||||
sprite_frames = SubResource("SpriteFrames_i8330")
|
||||
autoplay = "default"
|
||||
offset = Vector2(0, -9)
|
||||
script = ExtResource("1_3ik7t")
|
||||
|
||||
[node name="Attackbox" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Attackbox"]
|
||||
position = Vector2(-2, 3.5)
|
||||
shape = SubResource("RectangleShape2D_3ik7t")
|
||||
|
||||
[connection signal="animation_finished" from="." to="." method="_on_animation_finished"]
|
||||
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://stckm5d3gflm"]
|
||||
|
||||
[node name="PoundIce" type="Node2D"]
|
||||
Reference in New Issue
Block a user