TODO: Stun

main
Luna Brovchuk 2023-10-02 21:17:03 +02:00
parent 4f32f718c6
commit 043f3a5d93
4 changed files with 10 additions and 7 deletions

View File

@ -41,7 +41,9 @@ func area_entered(area):
prev_target = parent prev_target = parent
parent.deal_damage(damage) parent.deal_damage(damage)
parent.freeze_modifier = freeze_modifier parent.freeze_modifier = freeze_modifier
parent.frozen_timer = 0
parent.poison_damage = poison_damage parent.poison_damage = poison_damage
parent.poisoned_timer = 0
if bounced >= ricochet_count: if bounced >= ricochet_count:
call_deferred("free") call_deferred("free")
choose_target() choose_target()

View File

@ -16,7 +16,7 @@ use_parent_material = true
position = Vector2( -3, 0 ) position = Vector2( -3, 0 )
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 1 frame = 2
playing = true playing = true
centered = false centered = false

View File

@ -3,6 +3,7 @@ extends KinematicBody2D
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn") onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn") onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder" onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder"
var colorize_material = load("res://res/shaders/colorize.tres")
var outline_material = load("res://res/shaders/outline_material.tres") var outline_material = load("res://res/shaders/outline_material.tres")
#var outline_material = load("res://res/shaders/empty_material.tres") #var outline_material = load("res://res/shaders/empty_material.tres")
var speed_multiplier: float = 1.0 var speed_multiplier: float = 1.0
@ -10,6 +11,7 @@ var invincibility_timer = .0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
var recharge_timer = .0 var recharge_timer = .0
var invincible = false var invincible = false
var stunned = false
var target var target
var slowed = false var slowed = false
var speed = 80 var speed = 80
@ -146,11 +148,6 @@ func _process(_delta):
func _physics_process(delta): func _physics_process(delta):
get_input() get_input()
invincibility_timer += delta
if recharge_timer <= get_recharge():
recharge_timer += delta
var areas = $DirtCollision.get_overlapping_areas() var areas = $DirtCollision.get_overlapping_areas()
slowed = false slowed = false
for area in areas: for area in areas:
@ -172,6 +169,9 @@ func _physics_process(delta):
if Global.playing: if Global.playing:
$Sprite.playing = true $Sprite.playing = true
invincibility_timer += delta
if recharge_timer <= get_recharge():
recharge_timer += delta
velocity = move_and_slide(velocity * speed_multiplier) velocity = move_and_slide(velocity * speed_multiplier)
else: else:
$Sprite.playing = false $Sprite.playing = false
@ -180,7 +180,6 @@ func _physics_process(delta):
if Global.playing and target != null and is_instance_valid(target) and not target.dead: if Global.playing and target != null and is_instance_valid(target) and not target.dead:
target.material = outline_material target.material = outline_material
if recharge_timer >= get_recharge(): if recharge_timer >= get_recharge():
_shoot() _shoot()
recharge_timer = .0 recharge_timer = .0

View File

@ -59,12 +59,14 @@ func _physics_process(delta):
poisoned_damage_timer = 0 poisoned_damage_timer = 0
if freeze_modifier != 1: if freeze_modifier != 1:
$Sprite.modulate.b = 1.2
frozen_timer += delta frozen_timer += delta
speed_multiplier = freeze_modifier speed_multiplier = freeze_modifier
if frozen_timer >= frozen_time: if frozen_timer >= frozen_time:
frozen_time = 0 frozen_time = 0
freeze_modifier = 1 freeze_modifier = 1
else: else:
$Sprite.modulate.b = 1
speed_multiplier = 1 speed_multiplier = 1
if not Global.playing: if not Global.playing: