forked from AlyssonDaPaz/Mega-Man-X8-16-bit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLemon.gd
48 lines (37 loc) · 1.08 KB
/
Lemon.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
extends WeaponShot
class_name Lemon
var hit_time := 0.0
func _physics_process(delta: float) -> void:
process_hittime(delta)
func references_setup(direction):
set_direction(direction)
animatedSprite.scale.x = direction
$particles2D.scale.x = direction
update_facing_direction()
$animatedSprite.set_frame(int(rand_range(0,8)))
original_pitch = audio.pitch_scale
func process_hittime(delta):
if hit_time > 0:
hit_time += delta
if hit_time > time_outside_screen /3:
disable_particle_visual()
func hit(target):
if active:
hit_time = 0.01
countdown_to_destruction = 0.01
target.damage(damage, self)
#if target.is_in_group("Enemies"):
# Event.emit_signal("hit_enemy")
emit_hit_particle()
disable_projectile_visual()
call_deferred("disable_damage")
remove_from_group("Player Projectile")
func leave(_target):
pass
func deflect(_body) -> void:
.deflect(_body)
$deflect_particle.emit(facing_direction)
func launch_setup(direction, _launcher_velocity := 0.0):
set_horizontal_speed(horizontal_velocity * direction)
func disable_damage():
$collisionShape2D.disabled = true