cleaned up player script
This commit is contained in:
parent
3ff6631f5f
commit
209884f133
7 changed files with 12 additions and 93 deletions
|
@ -42,12 +42,16 @@ func _physics_process(delta):
|
|||
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
|
||||
|
@ -103,25 +107,22 @@ func _process_idle_walk():
|
|||
|
||||
func _process_jump():
|
||||
jump_pressure += 1
|
||||
move(walk_speed,0,true)
|
||||
check_double_jump()
|
||||
#Pressure sensitive jump
|
||||
if jump_pressure == 15 or Input.is_action_just_released("jump"):
|
||||
velocity.y = -jump_force / 4
|
||||
#velocity.y = 0
|
||||
current_state = State.FALL
|
||||
#Goto Shoot
|
||||
check_shoot()
|
||||
|
||||
func _process_fall():
|
||||
if anims.get_current_animation() != "doublejump": anims.play("jump")
|
||||
check_double_jump()
|
||||
#anims.play("jump")
|
||||
move(walk_speed,0,true)
|
||||
#Return to idle
|
||||
if is_on_floor():
|
||||
current_state = State.IDLE
|
||||
return
|
||||
|
||||
func _process_jump_fall():
|
||||
check_double_jump()
|
||||
move(walk_speed,0,true)
|
||||
#Goto Shoot
|
||||
check_shoot()
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ Game="*res://game.tscn"
|
|||
window/size/width=256
|
||||
window/size/height=192
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( )
|
||||
|
||||
[gui]
|
||||
|
||||
common/drop_mouse_on_gui_input_disabled=true
|
||||
|
|
BIN
sg_outline.png
BIN
sg_outline.png
Binary file not shown.
Before Width: | Height: | Size: 292 B |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sg_outline.png-d83bd4211370f1ca4f13854b52bba784.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sg_outline.png"
|
||||
dest_files=[ "res://.import/sg_outline.png-d83bd4211370f1ca4f13854b52bba784.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
|
BIN
test_outline.png
BIN
test_outline.png
Binary file not shown.
Before Width: | Height: | Size: 446 B |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/test_outline.png-718b593a40e1eb1f19a87019e56a4b0b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test_outline.png"
|
||||
dest_files=[ "res://.import/test_outline.png-718b593a40e1eb1f19a87019e56a4b0b.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
|
16
testwalk.gd
16
testwalk.gd
|
@ -1,16 +0,0 @@
|
|||
extends AnimatedSprite
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
var dir = Input.get_axis("ui_left","ui_right")
|
||||
position.x += dir
|
||||
#Flip Sprite
|
||||
if dir < 0.0:
|
||||
flip_h = true
|
||||
elif dir > 0.0:
|
||||
flip_h = false
|
||||
|
||||
if dir == 0:
|
||||
play("idle")
|
||||
else:
|
||||
play("move")
|
Loading…
Add table
Add a link
Reference in a new issue