tube transport! also 3-block jump marginally easier

This commit is contained in:
Haze Weathers 2023-01-22 22:24:50 -05:00
parent 4d13d2932c
commit 8c60bbf293
6 changed files with 101 additions and 123 deletions

View file

@ -14,7 +14,7 @@ onready var dust_particles = $DustParticles
#Map
onready var map = get_owner()
##States
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT,INACTIVE}
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT,INACTIVE,TRANSPORT}
var current_state = State.IDLE
##Runtime
var axis = Vector2.ZERO #Current direction being held
@ -25,10 +25,12 @@ var walk_speed = 50
var gravity = 12
var jump_pressure = 0
var jump_force = 150
var doublejump_force = 120
var doublejump_force = 122
var current_ladder = null #Used for checking climbing every frame instead of area entered
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
@ -70,6 +72,10 @@ func _physics_process(delta):
continue
State.SHOOT:
_process_shoot()
continue
State.TRANSPORT:
_process_transport(delta)
return
#Gravity
if current_state != State.CLIMB:
@ -188,7 +194,7 @@ func _process_sword():
#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
@ -199,6 +205,9 @@ func _process_shoot():
return
move(walk_speed,0,true)
func _process_transport(delta):
position += transport_direction * transport_speed * delta
func spawn_arrow():
Game.play_sound(Game.a_shoot,Game.ac_jump)
var arrow = ArrowProjectile.instance()
@ -269,6 +278,15 @@ func check_ladder():
#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
anims.play("doublejump")
func exit_transport():
current_state = State.FALL
func die():
if current_state == State.INACTIVE:
return