Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Newby |
I made this game project on godot 3.0.6 and updated it to 3.1.0 and now the HP script doesnt work.
This is a script that i use to extend to my KinematicBody2D characters (Enemies, Player)
extends KinematicBody2D
export var DMG: int
export var MAXHP: int
var HP=MAXHP
var dmg_timer=0
func dmg():
if dmg_timer>0:
dmg_timer-=1
for area in $hitbox.get_overlapping_areas():
var body=area.get_parent()
for i in 1:
if dmg_timer==0:
HP-=body.get("DMG")
dmg_timer=10
print(HP)
if HP<=0:
queue_free()
Originally it worked, it got the HP and DMG i set for the characters that extend the script, like 10 for the Player and 5 for the enemy, but now it just get the data from itself and now the only get 0 HP
I dont really know a lot about godot and its scripting so how can i make it so that my script runs normally again. What did they change in scripting for extending scripts.