Conversation
scripts/game/bullet_3.gd
Outdated
| body.health -= damage | ||
| _explode() | ||
| if body.has_method("take_damage"): | ||
| body.take_damage(insta_kill_amount, 1.0) |
There was a problem hiding this comment.
@iBerserker89 pelo que eu entendi a mina continua dando insta kill nos asteroids, acho que o melhor é ter uma função para calcular o dano e essa função ser utilizada tanto para o player qt para o inimigo
| if not vanish_timer.timeout.is_connected(_on_vanish_timer_timeout): | ||
| vanish_timer.timeout.connect(_on_vanish_timer_timeout) | ||
| await get_tree().create_timer(0.2).timeout | ||
| can_hit_player = true |
There was a problem hiding this comment.
@iBerserker89 pq essa variavel é declarada como false para depois mudar para true?
There was a problem hiding this comment.
func damage_player(body: Node) -> void:
if body is Player:
if not can_hit_player:
return
damage = body.acceleration / 30.0
if damage <= 10.0:
damage = 10.0
body.health -= damage
explode()
A variável vira true após o timer de 0.2s no _ready (logo após a mina ser instanciada), pra que o player não tome dano no momento em que instancia a mina no mapa.
scripts/game/bullet_3.gd
Outdated
| damage_enemy(body) | ||
| damage_player(body) |
There was a problem hiding this comment.
@iBerserker89 pq precisamos ter duas funções distintas? não da para unificar em apenas uma única função?
There was a problem hiding this comment.
Resolvido
func _on_body_entered(body: Node) -> void:
if body is Player:
if not can_hit_player:
return
damage = body.acceleration / 30.0
if damage <= 10.0:
damage = 10.0
body.health -= damage
if body.has_method("take_damage"):
damage = body.velocity.length() / 7.0
if damage <= 10.0:
damage = 10.0
body.take_damage(damage, 1.0)
print("ASTEROID damaged: ", snapped(damage, 0.01))
_explode()`
scripts/game/bullet_3.gd
Outdated
|
|
||
| ## Executa a animação e o som da explosão e desativa colisões. | ||
| func _explode() -> void: | ||
| func explode() -> void: |
There was a problem hiding this comment.
@iBerserker89 essa função é chamada fora desse script?
There was a problem hiding this comment.
Não, não é chamada fora do código. Resolvido
andrePfeiffer
left a comment
There was a problem hiding this comment.
@iBerserker89 porfavor veja meus comentarios
@andrePfeiffer Visto e resolvido. |
Descrição
Ações nas issues