Skip to main content
added 473 characters in body
Source Link
Cei
  • 873
  • 7
  • 20

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

The player calls the function that damages the enemies with :

func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
    if enemy.has_method("onhit"):
        #enemy.hurt()
        enemy.onhit(damage)

which is the mirrored version of the Enemy script... , it also has the function to be damaged:

func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true

it basically gets the (damage) from the enemy and the (defense) from the player... the opposite happens when the enemy is being hit.

so aggressor damage - victim defense = damage caused to victim

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

The player calls the function that damages the enemies with :

func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
    if enemy.has_method("onhit"):
        #enemy.hurt()
        enemy.onhit(damage)

which is the mirrored version of the Enemy script... , it also has the function to be damaged:

func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

The player calls the function that damages the enemies with :

func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
    if enemy.has_method("onhit"):
        #enemy.hurt()
        enemy.onhit(damage)

which is the mirrored version of the Enemy script... , it also has the function to be damaged:

func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true

it basically gets the (damage) from the enemy and the (defense) from the player... the opposite happens when the enemy is being hit.

so aggressor damage - victim defense = damage caused to victim

added 473 characters in body
Source Link
Cei
  • 873
  • 7
  • 20

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

The player calls the function that damages the enemies with :

func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
    if enemy.has_method("onhit"):
        #enemy.hurt()
        enemy.onhit(damage)

which is the mirrored version of the Enemy script... , it also has the function to be damaged:

func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

The player calls the function that damages the enemies with :

func attack():
var enemies = hitbox.get_overlapping_bodies()
for enemy in enemies:
    if enemy.has_method("onhit"):
        #enemy.hurt()
        enemy.onhit(damage)

which is the mirrored version of the Enemy script... , it also has the function to be damaged:

func onhit(damage):
$GUI/HealthBar.value = int((health / maxhealth) * 100)
health -= (damage - defense)
staggered = true
added 124 characters in body
Source Link
Cei
  • 873
  • 7
  • 20

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

followed this tutorial : https://www.youtube.com/watch?v=UlvBqz8bhCo

the guy is working mostly in 2D, i tried to apply the same method but I'm hating working with UI in godot, everytime I seem to get something right, I get 100 more wrong.

the problem I'm having is that when I hit multiple enemies, only one damage indicator shows enter image description here

so basically in the code the func _ready() animates the damage indicator making it shrinks after it appears... and the self.queue_free() deletes the damage after the animation is complete

I'm using a third person controller with a crossair, the damage shows offset to the left of the crossair, which is perfect for now... but no matter how many enemies I hit... only one damage pop up shows... even when enemies have different ammounts of defense so it should show diferent damage texts... it only ever shows the damage of the first enemy hit

enter image description here

the floating damage is called by the enemy when it is hit enter image description here

there is the full enemy.gd code https://github.com/Ceisri/Godot-Action-Combat/blob/main/Creatures/Enemies/Enemy.gd

added 149 characters in body
Source Link
Cei
  • 873
  • 7
  • 20
Loading
Source Link
Cei
  • 873
  • 7
  • 20
Loading