partially reimplemented cheats

This commit is contained in:
penelope 2023-06-01 22:01:57 -04:00
parent bfa052968b
commit 9f7668107b
4 changed files with 16 additions and 1181 deletions

View file

@ -1,430 +0,0 @@
extends KinematicBody2D
signal hatch_exited
const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
##CLEAN UP CODE LATER
##Movement
export var use_iframes = false
export var walk_speed = 50
export var gravity = 12
export var max_fall_speed = INF
export var jump_time = 15
export var jump_force = 150
export var doublejump_force = 122
##Children
onready var sprite = $Sprite
onready var climb_ray = $ClimbRay
onready var anims = $AnimationPlayer
onready var sword_sprite = $SwordSprite
onready var sword_hitbox = $SwordArea
onready var death_particles = $DeathSplatter
onready var dust_particles = $DustParticles
onready var iframe_timer = $IframeTimer
onready var hitbox = $Area2D/CollisionShape2D2
#Map
onready var map = get_owner()
##States
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT,INACTIVE,TRANSPORT,HATCH}
var current_state = State.IDLE
var can_die = true
var dead = false
##Runtime
var axis = Vector2.ZERO #Current direction being held
var trail_color = Color(0.25,0,1,0.4)
#Physics
var velocity = Vector2.ZERO
var current_ladder = null #Used for checking climbing every frame instead of area entered
var jump_pressure = 0
var can_doublejump = true
var can_move_in_air = false
var transport_speed = 0.0
var transport_direction = Vector2.ZERO
#Positions
var arrowpos = Vector2(5,3)
##Preload
#Set initial respawn point
func _ready():
$LeftShoe.shape.length = 0.0
Game.respawn_point = global_position
func _physics_process(delta):
if current_state == State.INACTIVE:
return
axis = Vector2(Input.get_axis("ui_left","ui_right"),Input.get_axis("ui_up","ui_down"))
#Check ladder
check_ladder()
match current_state:
State.IDLE:
_process_idle()
continue
State.WALK:
_process_walk()
continue
State.IDLE, State.WALK:
_process_idle_walk()
continue
State.JUMP:
_process_jump()
continue
State.FALL:
_process_fall()
continue
State.JUMP, State.FALL:
_process_jump_fall()
continue
State.CLIMB:
_process_climb()
continue
State.SWORD:
_process_sword()
continue
State.SHOOT:
_process_shoot()
continue
State.TRANSPORT:
_process_transport(delta)
return
State.HATCH:
_process_hatch(delta)
return
#Gravity
if current_state != State.CLIMB:
velocity.y = min(velocity.y + gravity, max_fall_speed)
#Cut y velocity when hitting ceiling
if is_on_ceiling():
current_state = State.FALL
position.y += 1
velocity.y = 0
#Apply velocity
var snap = Vector2.ZERO
if velocity.y < 0.0 and current_ladder == null:
snap.y = 1.0
move_and_slide_with_snap(velocity, snap, Vector2.UP, true)
#Moon Jump
if Debug.moon_jump == true: can_doublejump = true
#2011
if Debug.cfox_mode == true:
anims.play("idle")
anims.set_speed_scale(0)
#Infinite arrows
if Debug.infinite_arrows == true:
Game.arrows = 99
func _process_idle():
if anims.get_current_animation() != "idle": anims.play("idle")
#Stop
velocity.x = 0
#Goto Walk
if axis.x != 0: current_state = State.WALK
func _process_walk():
if anims.get_current_animation() != "walk": anims.play("walk")
#Move
move(walk_speed,0,true)
#Goto Idle
if axis.x == 0: current_state = State.IDLE
#Push Blocks
for i in get_slide_count():
var collision = get_slide_collision(i)
if collision.get_collider().is_in_group("pushable"):
collision.get_collider().push(collision.normal)
func _process_idle_walk():
can_doublejump = false
can_move_in_air = false
velocity.y = 0
#Goto Fall
if !is_on_floor(): current_state = State.FALL
#Goto Jump
check_jump()
#Goto Sword
if Debug.allow_sword && Input.is_action_just_pressed("sword"):
Audio.play_sound(Audio.a_sword,Audio.ac_jump)
current_state = State.SWORD
return
#Goto Shoot
check_shoot()
func _process_jump():
jump_pressure += 1
#Pressure sensitive jump
if jump_pressure >= jump_time or Input.is_action_just_released("jump"):
velocity.y = -jump_force / 4
#velocity.y = 0
current_state = State.FALL
func _process_fall():
if anims.get_current_animation() != "doublejump": anims.play("jump")
#Return to idle
if is_on_floor():
current_state = State.IDLE
return
#Cant move in air
if !can_move_in_air: velocity.x = 0
func _process_jump_fall():
check_double_jump()
move(walk_speed,0,true)
#Goto Shoot
check_shoot()
func _process_climb():
can_move_in_air = true
can_doublejump = true
#Graphics
anims.play("climb")
anims.set_speed_scale(abs(axis.y))
#Climb
position.y += axis.y * 0.65
#Sound
if axis.y == -1:
if Audio.ac_climb.get_stream() != Audio.a_climb_up: Audio.play_sound(Audio.a_climb_up,Audio.ac_climb)
if axis.y == 1:
if Audio.ac_climb.get_stream() != Audio.a_climb_down: Audio.play_sound(Audio.a_climb_down,Audio.ac_climb)
if axis.y == 0: Audio.ac_climb.set_stream(null)
#Manual Jump,, only works when holding neutral or away from ladder
if axis.x != sprite.scale.x && Input.is_action_just_pressed("jump"):
position.x -= sprite.scale.x * 3
velocity.y = -jump_force
anims.set_speed_scale(1)
current_state = State.FALL
Audio.ac_climb.set_stream(null)
return
if climb_ray.get_collider() == null:
if axis.y == -1:
#Auto Jump
velocity.y = -jump_force
Audio.play_sound(Audio.a_jump,Audio.ac_jump)
#Auto dismount
Audio.ac_climb.set_stream(null)
current_state = State.FALL
return
#Side dismount
if axis.x != sprite.scale.x && Input.is_action_just_pressed("shoot"):
position.x -= sprite.scale.x * 3
current_state = State.FALL
anims.set_speed_scale(1)
Audio.ac_climb.set_stream(null)
return
func _process_sword():
anims.play("stab")
#Stop
velocity.x = 0
sword_sprite.scale.x = sprite.scale.x
#Move hitbox with flip
sword_hitbox.position.x = sprite.scale.x * 10
#Return to idle after animationplayer end anim signal
func _process_shoot():
#Stop
velocity.x = 0
if anims.get_current_animation() == "shoot air":
#Cancel air shoot animation when grounded
if is_on_floor():
current_state = State.IDLE
return
move(walk_speed,0,true)
func _process_transport(delta):
position += transport_direction * transport_speed * delta
func _process_hatch(delta):
if Input.is_action_just_pressed("exit_hatch"):
anims.play("enter hatch", -1, -2,true)
emit_signal("hatch_exited")
func spawn_arrow():
Audio.play_sound(Audio.a_shoot,Audio.ac_jump)
var arrow = ArrowProjectile.instance()
arrow.global_position = Vector2(
global_position.x + arrowpos.x * sprite.scale.x,
global_position.y + arrowpos.y
)
arrow.direction = sprite.scale.x
arrow.add_to_group("player_arrow")
map.add_child(arrow)
func check_jump():
if Input.is_action_just_pressed("jump"):
#Detach ladder
if current_state == State.CLIMB:
Audio.ac_climb.set_stream(null) # stop climb sound
position.x -= sprite.scale.x * 3
else:
dust_particles.restart()
anims.set_speed_scale(1)
# Jump
can_doublejump = true
can_move_in_air = true
velocity.y = 0
jump_pressure = 0
current_state = State.JUMP
Audio.play_sound(Audio.a_jump,Audio.ac_jump)
anims.play("jump")
velocity.y = -jump_force
move(walk_speed,0,true)
func check_double_jump():
if is_on_floor():
check_jump()
if Input.is_action_just_pressed("jump") && can_doublejump:
Audio.play_sound(Audio.a_doublejump,Audio.ac_jump)
can_doublejump = false
velocity.y = -doublejump_force
anims.play("doublejump")
func check_shoot():
#Only Shoot if have arrows and there are no arrows onscreen
if Input.is_action_just_pressed("shoot") && Game.arrows > 0 && get_tree().get_nodes_in_group("player_arrow").size() == 0:
current_state = State.SHOOT
if is_on_floor():
anims.play("shoot grounded")
else:
anims.play("shoot air") #Shoot immediately in air
func move(hsp,vsp,flip:bool):
if is_on_floor() or can_move_in_air:
velocity.x = hsp * axis.x
#Flip
if flip: if sign(axis.x) != 0: sprite.scale.x = axis.x
func check_ladder():
if climb_ray.get_collider() != null:
current_ladder = climb_ray.get_collider().get_parent()
#Stop the velocity
velocity = Vector2.ZERO
#Snap to closest side
if position.x < current_ladder.middle:
position.x = current_ladder.left_snap.global_position.x
sprite.scale.x = 1
else:
position.x = current_ladder.right_snap.global_position.x
sprite.scale.x = -1
#Start Climbing
current_state = State.CLIMB
#Move the raycast
#climb_ray.position.x = 4 * sprite.scale.x
func enter_transport(speed, direction):
transport_speed = speed
transport_direction = direction
current_state = State.TRANSPORT
can_doublejump = false
anims.play("doublejump")
func exit_transport():
current_state = State.FALL
func enter_hatch(snap_position):
if dead:
return
position = snap_position
current_state = State.INACTIVE
hitbox.disabled = true
collision_layer = 0
anims.play("enter hatch", -1, 2)
func die():
#If the player is already dead, don't kill them again
if current_state == State.INACTIVE or current_state == State.HATCH:
return
if can_die:
dead = true
Audio.ac_climb.set_stream(null) # stop climbing sound\
#Create particles
var new_particles = death_particles.duplicate()
get_parent().add_child(new_particles)
new_particles.global_position = global_position
new_particles.emitting = true
sprite.visible = false
current_state = State.INACTIVE # Set to state where player is not controllable
position = Game.respawn_point # Set respawn point
if Game.lives <= 0 && Game.use_lives:
#Gover
#Particles
new_particles.amount = 64
new_particles.lifetime = 0.45
new_particles.speed_scale = 1.5
current_state = State.INACTIVE # Set to state where player is not controllable
Audio.play_sound(Audio.a_gover, Audio.ac_die)
#Slow down time
var time_tween = get_tree().create_tween()
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
Audio.ac_music.stream_paused = true
yield(time_tween, "finished") #Resume from freeze frame
yield(get_tree().create_timer, "timeout")
Game.call_deferred("restart_level")
else:
#Die
Game.lives -= 1
Game.deaths += 1
Audio.play_sound(Audio.a_die, Audio.ac_die)
yield(Game.freeze_frame(0.3), "timeout")
#Reduce points if playing in infinite lives mode
if Game.use_lives == false && Game.lives < 0:
Game.score = max(0,Game.score - 500)
#Iframes after respawn
if use_iframes:
iframe_timer.start()
can_die = false
#Respawn player
current_state = State.IDLE
sprite.visible = true
dead = false
func _on_AnimationPlayer_animation_finished(anim_name):
#Set hatch state
if anim_name == "enter hatch":
match current_state:
State.INACTIVE:
current_state = State.HATCH
return
State.HATCH:
current_state = State.IDLE
hitbox.disabled = false
collision_layer = 2
return
if current_state == State.INACTIVE:
return
#Return to idle after slash
if anim_name == "stab":
current_state = State.IDLE
return
#Return to idle after grounded shoot
if anim_name == "shoot grounded":
current_state = State.IDLE
return
#Return to fall or idle after air shoot
if anim_name == "shoot air":
if is_on_floor():
current_state = State.IDLE
return
else:
current_state = State.FALL
return
func _on_SwordArea_area_entered(area):
if area.is_in_group("enemy_hitbox"):
var target = area.get_parent()
# create block text and return if blocked
if area.is_in_group("blocks_sword"):
var pos = target.global_position
Game.instance_node(Game.block_text, pos.x, pos.y, target.get_parent())
return
else:
target.die()
func _on_Area2D_body_entered(body):
if body.is_in_group("death"): die()
func _on_IframeTimer_timeout():
can_die = true

View file

@ -1,751 +0,0 @@
[gd_scene load_steps=34 format=2]
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
[ext_resource path="res://graphics/player/sg_walk.png" type="Texture" id=2]
[ext_resource path="res://graphics/player/sg_idle.png" type="Texture" id=3]
[ext_resource path="res://shaders/recolor_border.shader" type="Shader" id=4]
[ext_resource path="res://graphics/player/sg_jump.png" type="Texture" id=5]
[ext_resource path="res://graphics/player/pal_purplearmor.png" type="Texture" id=6]
[ext_resource path="res://graphics/player/sg_climb.png" type="Texture" id=7]
[ext_resource path="res://graphics/player/pal_sword_red.png" type="Texture" id=8]
[ext_resource path="res://graphics/player/sg_stab.png" type="Texture" id=9]
[ext_resource path="res://graphics/player/sg_shoot_grounded.png" type="Texture" id=10]
[ext_resource path="res://graphics/player/sword_stab.png" type="Texture" id=11]
[ext_resource path="res://graphics/player/sg_shoot_air.png" type="Texture" id=12]
[ext_resource path="res://shaders/recolor.tres" type="Shader" id=13]
[ext_resource path="res://graphics/player/sg_doublejump.png" type="Texture" id=14]
[ext_resource path="res://objects/player/player_death_particles.tscn" type="PackedScene" id=15]
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=16]
[ext_resource path="res://scripts/snap_sprite.gd" type="Script" id=17]
[sub_resource type="ShaderMaterial" id=38]
resource_local_to_scene = true
shader = ExtResource( 4 )
shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = true
shader_param/palette = ExtResource( 6 )
[sub_resource type="ShaderMaterial" id=28]
shader = ExtResource( 13 )
shader_param/palette = ExtResource( 8 )
[sub_resource type="RectangleShape2D" id=6]
extents = Vector2( 2.5, 5 )
[sub_resource type="RectangleShape2D" id=39]
extents = Vector2( 2.5, 5 )
[sub_resource type="RayShape2D" id=44]
length = 0.01
[sub_resource type="Animation" id=29]
resource_name = "climb"
length = 0.3
loop = true
step = 0.15
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 7 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=35]
resource_name = "doublejump"
length = 0.3
loop = true
step = 0.038
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.038, 0.076, 0.114, 0.152, 0.19, 0.228, 0.266 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 14 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0, 0.038, 0.076, 0.114, 0.152, 0.19, 0.228, 0.266, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0.0, 0.0, 90.0, 90.0, 180.0, 180.0, 270.0, 270.0, 360.0 ]
}
[sub_resource type="Animation" id=45]
resource_name = "enter hatch"
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:offset")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.3, 0.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -6 ), Vector2( 0, 0 ), Vector2( 0, 10 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 5 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:region_rect")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.3, 0.5 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Rect2( 1, 0, 20, 20 ), Rect2( 1, 0, 20, 20 ), Rect2( 1, 0, 20, 0 ) ]
}
[sub_resource type="Animation" id=30]
resource_name = "idle"
length = 0.5
loop = true
step = 0.06
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 3 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=31]
resource_name = "jump"
length = 0.5
loop = true
step = 0.06
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ Rect2( 1, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 5 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=37]
resource_name = "shoot air"
length = 0.5
step = 0.06
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ Rect2( 1, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 12 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/5/type = "method"
tracks/5/path = NodePath(".")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "spawn_arrow"
} ]
}
[sub_resource type="Animation" id=36]
resource_name = "shoot grounded"
length = 0.25
step = 0.06
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.03, 0.06, 0.12, 0.15, 0.18 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 40, 0, 20, 20 ), Rect2( 60, 0, 20, 20 ), Rect2( 80, 0, 20, 20 ), Rect2( 100, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 10 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( ),
"transitions": PoolRealArray( ),
"update": 1,
"values": [ ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/5/type = "method"
tracks/5/path = NodePath(".")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0.12 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "spawn_arrow"
} ]
}
[sub_resource type="Animation" id=32]
resource_name = "stab"
length = 0.3
step = 0.06
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.06 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 32, 32 ), Rect2( 32, 0, 32, 32 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 9 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.06 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 11 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("SwordSprite:region_rect")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0, 0.06 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 32, 32 ), Rect2( 32, 0, 32, 32 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=33]
resource_name = "walk"
length = 0.4
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 40, 0, 20, 20 ), Rect2( 60, 0, 20, 20 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 2 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SwordSprite:texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ null ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:rotation_degrees")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="RectangleShape2D" id=34]
extents = Vector2( 6, 7 )
[sub_resource type="Curve" id=43]
_data = [ Vector2( 0, 1 ), 0.0, -0.0636948, 0, 0, Vector2( 1, 0 ), -3.43886, 0.0, 0, 0 ]
[node name="Player" type="KinematicBody2D"]
collision_layer = 0
collision_mask = 7
script = ExtResource( 1 )
max_fall_speed = 255.0
[node name="Trail" type="Node" parent="."]
[node name="Sprite" type="Sprite" parent="."]
material = SubResource( 38 )
texture = ExtResource( 3 )
region_enabled = true
region_rect = Rect2( 0, 0, 20, 20 )
script = ExtResource( 17 )
[node name="SwordSprite" type="Sprite" parent="."]
material = SubResource( 28 )
region_enabled = true
region_rect = Rect2( 0, 0, 32, 32 )
script = ExtResource( 17 )
[node name="Area2D" type="Area2D" parent="." groups=["player"]]
position = Vector2( 0, 3 )
collision_layer = 11
collision_mask = 33
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 0.5, 2 )
shape = SubResource( 6 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0.5, 5 )
shape = SubResource( 39 )
[node name="LeftShoe" type="CollisionShape2D" parent="."]
position = Vector2( -2, 10 )
shape = SubResource( 44 )
[node name="RightShoe" type="CollisionShape2D" parent="."]
position = Vector2( 3, 10 )
shape = SubResource( 44 )
[node name="ClimbRay" type="RayCast2D" parent="."]
position = Vector2( 0.5, 10 )
enabled = true
cast_to = Vector2( 0, -10 )
collision_mask = 64
collide_with_areas = true
collide_with_bodies = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/climb = SubResource( 29 )
anims/doublejump = SubResource( 35 )
"anims/enter hatch" = SubResource( 45 )
anims/idle = SubResource( 30 )
anims/jump = SubResource( 31 )
"anims/shoot air" = SubResource( 37 )
"anims/shoot grounded" = SubResource( 36 )
anims/stab = SubResource( 32 )
anims/walk = SubResource( 33 )
[node name="SwordArea" type="Area2D" parent="." groups=["sword"]]
visible = false
[node name="SwordHitBox" type="CollisionShape2D" parent="SwordArea"]
position = Vector2( 0, 3 )
shape = SubResource( 34 )
disabled = true
[node name="DeathSplatter" parent="." instance=ExtResource( 15 )]
[node name="DustParticles" type="CPUParticles2D" parent="."]
position = Vector2( 0, 12 )
z_index = 1
emitting = false
amount = 5
lifetime = 0.3
one_shot = true
explosiveness = 0.9
fract_delta = false
local_coords = false
texture = ExtResource( 16 )
emission_shape = 2
emission_rect_extents = Vector2( 5, 0 )
direction = Vector2( 0, -1 )
spread = 60.0
gravity = Vector2( 0, 0 )
initial_velocity = 10.0
initial_velocity_random = 0.8
angle = 720.0
angle_random = 1.0
scale_amount = 0.25
scale_amount_random = 0.5
scale_amount_curve = SubResource( 43 )
[node name="IframeTimer" type="Timer" parent="."]
wait_time = 0.5
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
[connection signal="area_entered" from="SwordArea" to="." method="_on_SwordArea_area_entered"]
[connection signal="timeout" from="IframeTimer" to="." method="_on_IframeTimer_timeout"]

View file

@ -65,6 +65,7 @@ func _ready() -> void:
state_chart.initialize() state_chart.initialize()
state_chart.set_guard_property("can_respawn", true) state_chart.set_guard_property("can_respawn", true)
state_chart.set_guard_property("use_iframes", use_iframes) state_chart.set_guard_property("use_iframes", use_iframes)
state_chart.set_guard_property("red_feather", false)
# state chart debug # state chart debug
$StateDebugLayer/StateChartDebug.target = state_chart $StateDebugLayer/StateChartDebug.target = state_chart
@ -90,6 +91,12 @@ func _physics_process(delta: float) -> void:
if ladder_detector.is_colliding(): if ladder_detector.is_colliding():
state_chart.send_event("ladder_touched") state_chart.send_event("ladder_touched")
#Cheats
#CFox mode
if Debug.cfox_mode == true:
animation_player.play("idle")
animation_player.set_speed_scale(0)
# HELPER FUNCTIONS # # HELPER FUNCTIONS #
## spawns an arrow ## spawns an arrow

View file

@ -996,6 +996,15 @@ __meta__ = {
} }
initial_state = NodePath("Falling") initial_state = NodePath("Falling")
[node name="On Jump If Redfeather" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource( 10 )
__meta__ = {
"_editor_description_": "enter double jump state when the jump button is pressed"
}
to = NodePath("../Jump/NormalJump")
event = "jump"
guard_expression = "red_feather"
[node name="On Grounded" type="Node" parent="StateChart/Root/Movement/Airborne"] [node name="On Grounded" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource( 10 ) script = ExtResource( 10 )
to = NodePath("../../Grounded") to = NodePath("../../Grounded")