From 043f3a5d93c6a8293ecb63e6bc3bce764d4cd7b6 Mon Sep 17 00:00:00 2001 From: Luna Brovchuk Date: Mon, 2 Oct 2023 21:17:03 +0200 Subject: [PATCH] TODO: Stun --- src/models/bullet/bullet.gd | 2 ++ src/models/enemies/rat/Rat.tscn | 2 +- src/models/player/player.gd | 11 +++++------ src/scripts/enemy_class.gd | 2 ++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/models/bullet/bullet.gd b/src/models/bullet/bullet.gd index 24b5ff6..364b5e2 100644 --- a/src/models/bullet/bullet.gd +++ b/src/models/bullet/bullet.gd @@ -41,7 +41,9 @@ func area_entered(area): prev_target = parent parent.deal_damage(damage) parent.freeze_modifier = freeze_modifier + parent.frozen_timer = 0 parent.poison_damage = poison_damage + parent.poisoned_timer = 0 if bounced >= ricochet_count: call_deferred("free") choose_target() diff --git a/src/models/enemies/rat/Rat.tscn b/src/models/enemies/rat/Rat.tscn index 4bbe4eb..72461de 100644 --- a/src/models/enemies/rat/Rat.tscn +++ b/src/models/enemies/rat/Rat.tscn @@ -16,7 +16,7 @@ use_parent_material = true position = Vector2( -3, 0 ) frames = ExtResource( 1 ) animation = "idle" -frame = 1 +frame = 2 playing = true centered = false diff --git a/src/models/player/player.gd b/src/models/player/player.gd index b94a4e1..27445bb 100644 --- a/src/models/player/player.gd +++ b/src/models/player/player.gd @@ -3,6 +3,7 @@ extends KinematicBody2D onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn") onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn") 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/empty_material.tres") var speed_multiplier: float = 1.0 @@ -10,6 +11,7 @@ var invincibility_timer = .0 var velocity = Vector2.ZERO var recharge_timer = .0 var invincible = false +var stunned = false var target var slowed = false var speed = 80 @@ -146,11 +148,6 @@ func _process(_delta): func _physics_process(delta): get_input() - invincibility_timer += delta - - if recharge_timer <= get_recharge(): - recharge_timer += delta - var areas = $DirtCollision.get_overlapping_areas() slowed = false for area in areas: @@ -172,6 +169,9 @@ func _physics_process(delta): if Global.playing: $Sprite.playing = true + invincibility_timer += delta + if recharge_timer <= get_recharge(): + recharge_timer += delta velocity = move_and_slide(velocity * speed_multiplier) else: $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: target.material = outline_material - if recharge_timer >= get_recharge(): _shoot() recharge_timer = .0 diff --git a/src/scripts/enemy_class.gd b/src/scripts/enemy_class.gd index 0283a41..d22d577 100644 --- a/src/scripts/enemy_class.gd +++ b/src/scripts/enemy_class.gd @@ -59,12 +59,14 @@ func _physics_process(delta): poisoned_damage_timer = 0 if freeze_modifier != 1: + $Sprite.modulate.b = 1.2 frozen_timer += delta speed_multiplier = freeze_modifier if frozen_timer >= frozen_time: frozen_time = 0 freeze_modifier = 1 else: + $Sprite.modulate.b = 1 speed_multiplier = 1 if not Global.playing: