Added multiple skills
This commit is contained in:
parent
7937645028
commit
cf155d9aab
@ -1,7 +1,7 @@
|
|||||||
class_name Player
|
class_name Player
|
||||||
extends CharacterBody3D
|
extends CharacterBody3D
|
||||||
|
|
||||||
signal attacked
|
signal skill_used(slot: int)
|
||||||
signal dashed
|
signal dashed
|
||||||
signal jumped
|
signal jumped
|
||||||
signal name_changed(new_name: String)
|
signal name_changed(new_name: String)
|
||||||
@ -10,8 +10,8 @@ signal direction_changed
|
|||||||
var id: String
|
var id: String
|
||||||
var controller: Controller
|
var controller: Controller
|
||||||
|
|
||||||
func attack():
|
func use_skill(slot: int):
|
||||||
attacked.emit()
|
skill_used.emit(slot)
|
||||||
|
|
||||||
func dash():
|
func dash():
|
||||||
dashed.emit()
|
dashed.emit()
|
||||||
|
@ -11,7 +11,7 @@ var skip: int
|
|||||||
func _ready():
|
func _ready():
|
||||||
var player := owner as Player
|
var player := owner as Player
|
||||||
player.dashed.connect(dash)
|
player.dashed.connect(dash)
|
||||||
player.attacked.connect(attack)
|
player.skill_used.connect(use_skill)
|
||||||
movement = player.find_child("Movement")
|
movement = player.find_child("Movement")
|
||||||
animation_player = $AnimationPlayer
|
animation_player = $AnimationPlayer
|
||||||
|
|
||||||
@ -24,6 +24,11 @@ func _process(_delta):
|
|||||||
|
|
||||||
animation_player.play(next_animation)
|
animation_player.play(next_animation)
|
||||||
|
|
||||||
|
if animation_player.current_animation == "human/spin":
|
||||||
|
animation_player.speed_scale = 2.0
|
||||||
|
else:
|
||||||
|
animation_player.speed_scale = 1.0
|
||||||
|
|
||||||
func play_movement():
|
func play_movement():
|
||||||
if !movement:
|
if !movement:
|
||||||
play(RESET)
|
play(RESET)
|
||||||
@ -41,7 +46,11 @@ func play_movement():
|
|||||||
func dash():
|
func dash():
|
||||||
play_with_duration("human/roll", 1.0)
|
play_with_duration("human/roll", 1.0)
|
||||||
|
|
||||||
func attack():
|
func use_skill(slot: int):
|
||||||
|
match slot:
|
||||||
|
0:
|
||||||
|
play_with_duration("human/spin", 0.9)
|
||||||
|
1:
|
||||||
play_with_duration("human/slash", 1.0)
|
play_with_duration("human/slash", 1.0)
|
||||||
|
|
||||||
func play(action_name: StringName):
|
func play(action_name: StringName):
|
||||||
|
@ -30,5 +30,6 @@ func _unhandled_input(event):
|
|||||||
if event.is_action_pressed("dash"):
|
if event.is_action_pressed("dash"):
|
||||||
player.dash()
|
player.dash()
|
||||||
|
|
||||||
if event.is_action_pressed("attack"):
|
for i in range(4):
|
||||||
player.attack()
|
if event.is_action_pressed("skill_%d" % (i + 1)):
|
||||||
|
player.use_skill(i)
|
||||||
|
@ -7,9 +7,9 @@ var area: Area3D
|
|||||||
func _ready():
|
func _ready():
|
||||||
player = owner
|
player = owner
|
||||||
area = %MeleeArea
|
area = %MeleeArea
|
||||||
player.attacked.connect(attack)
|
player.skill_used.connect(use_skill)
|
||||||
|
|
||||||
func attack():
|
func use_skill(_slot: int):
|
||||||
await get_tree().create_timer(0.7).timeout
|
await get_tree().create_timer(0.7).timeout
|
||||||
area.monitoring = true
|
area.monitoring = true
|
||||||
await get_tree().create_timer(0.1).timeout
|
await get_tree().create_timer(0.1).timeout
|
||||||
|
@ -79,18 +79,6 @@ dash={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
attack={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
aim={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
menu={
|
menu={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
@ -132,6 +120,28 @@ zoom_out={
|
|||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194435,"key_label":0,"unicode":45,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194435,"key_label":0,"unicode":45,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
skill_1={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
skill_2={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
skill_3={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
skill_4={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":116,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user