feat: 躲避敌人攻击功能
fix: 敌人初始化血条
This commit is contained in:
+10
-8
@@ -1,13 +1,15 @@
|
||||
extends Node
|
||||
|
||||
const FLASH_MATERIAL = preload("uid://cwtrdmkrsmw23")
|
||||
|
||||
var player: Player
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
# 尝试阻止敌人攻击,获取闪避, unit_stats block_chance 越大
|
||||
# 成功率越高
|
||||
func get_chance_success(chance: float) -> bool:
|
||||
var random := randf_range(0, 1.0)
|
||||
|
||||
if random < chance:
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user