se faire taper dessus et pu être en fullscreen

This commit is contained in:
MarcEricMartel 2023-10-10 17:03:49 -04:00
parent 74fa828082
commit 8114b979b4
3 changed files with 25 additions and 6 deletions

View File

@ -399,6 +399,7 @@ angular_velocity_max = 50.0
color = Color(0.623529, 0, 0, 0.729412) color = Color(0.623529, 0, 0, 0.729412)
[node name="Atk_cooldown" type="Timer" parent="."] [node name="Atk_cooldown" type="Timer" parent="."]
wait_time = 2.0
autostart = true autostart = true
[node name="LvlUp" type="CPUParticles2D" parent="."] [node name="LvlUp" type="CPUParticles2D" parent="."]

View File

@ -6,14 +6,16 @@ extends CharacterBody2D
@onready var is_attacking: bool = false @onready var is_attacking: bool = false
@onready var is_dying: bool = false @onready var is_dying: bool = false
@export var level: int = 1 @export var level: int = 7
@export var hp: int = 100 @export var hp: int = 100
@export var maxhp: int = 100 @export var maxhp: int = 100
@export var maxvel: float = 2 @export var maxvel: float = 2
@export var experience: int = 0 @export var experience: int = 0
@export var state: String = "Idle" @export var state: String = "Idle"
@export var damage: int = 5 @export var damage: int = 5
@export var maxAtks: int = 1
@onready var currAtks: int = 0
@onready var anim: Node = get_node("Sprite") @onready var anim: Node = get_node("Sprite")
@onready var cooldown: Node = get_node("Atk_cooldown") @onready var cooldown: Node = get_node("Atk_cooldown")
@onready var lvlanim: Node = get_node("LvlUp") @onready var lvlanim: Node = get_node("LvlUp")
@ -47,10 +49,13 @@ func _process(delta):
is_facing_left = velocity.x >= 0 is_facing_left = velocity.x >= 0
# AI STUFF # AI STUFF
velocity = processAI(list,delta) #velocity = processAI(list,delta)
velocity.x += delta
velocity.y += delta
if !hitanim.is_emitting(): if !hitanim.is_emitting():
anim.modulate(Color(0,0,0,1)) anim.modulate.a = 1
move_and_slide() move_and_slide()
@ -98,7 +103,7 @@ func receive_damage(dmg):
pass pass
hp -= dmg hp -= dmg
hitanim.restart() hitanim.restart()
anim.modulate(Color(0,0,0,.5)) anim.modulate.a = 0.5
if hp < 0: if hp < 0:
velocity = Vector2(0,0) velocity = Vector2(0,0)
setAnimState("Die") setAnimState("Die")
@ -118,16 +123,30 @@ func setLevel(lvl):
lvlsnd.play() lvlsnd.play()
if level > 2: if level > 2:
cooldown.wait_time = 0.5 cooldown.wait_time = 1
if level > 5:
damage = 12
if level > 7:
maxAtks = 2
maxhp += 5
hp = maxhp
func _on_atk_cooldown_timeout(): func _on_atk_cooldown_timeout():
currAtks = maxAtks
attack() attack()
func _on_sprite_animation_looped(): func _on_sprite_animation_looped():
if is_attacking: if is_attacking:
currAtks -= 1
stop_attack() stop_attack()
if currAtks > 0:
is_facing_left = !is_facing_left
attack()
is_dying = false is_dying = false

View File

@ -19,7 +19,6 @@ config/icon="res://icon.svg"
window/size/viewport_width=960 window/size/viewport_width=960
window/size/viewport_height=540 window/size/viewport_height=540
window/size/mode=3
window/size/resizable=false window/size/resizable=false
window/stretch/mode="viewport" window/stretch/mode="viewport"