#oh
1 messages · Page 1 of 1 (latest)
current code
enemy code
since enemy is a monobehavior script
shouldnt this work?
enemy is the file name, not the class name
just change it
yeah, or change your class name to "Enemy"
updated script
genuinley unsure why its not working
enemy is in correct layer, code seems good (i think), damage math sould be correct
you havent even said what is supposed to happen
oh sorry
the enemy is not dying
the enemy is supposed to die
with the current values (damage being 1) and enemy health being 2,
2 hits should kill the enemy
debug your code
ran debug for both, no issues
yeah that's not what i was talking about
i meant adding debug.log statements to your code
ohhhhhh
ok attack seems to be triggering without issues
enemy taking damage is the issue
i guess
it only works when enemy has a box collider
and rigidbody
is there a reason to that
yeah, a rb is necessary for a collider to be triggered and detected
thank you bro
i really appreciate all the help
is there a way so i can visualize my attack range during gameplay?
Yeah you can draw gizmos
i thought that only works i the editor
ohh // Draw the attack range in the game view
Debug.DrawLine(attackPos.position, attackPosition, Color.red, 0.1f); // Draw for 0.1 seconds?
im gonna tweak
the direction is correct
but the damage is dealt right
my directional attack broken
;-;
probably you have named things terribly and confused yourself. lastDirection attackPosition , the "attack position" log and the line you draw here all can be deleted because they have no bearing on what gets hit. At a guess, you meant to use attackPosition instead of attackPos.position in your overlap query
otherwise it makes no sense for those other things to be there
blunt a hahaha
thank you