[SOLVED] Reflective Shield

Hi everyone i started this level (rip my gems) and i reflect the spell but it does’nt damage nalfar. Is this a bug?

image

code
# Use hero.reflect() to reflect back Nalfar's projectiles!
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        dir = Vector.subtract(enemy.pos, hero.pos).normalize()
        hero.reflect(Vector(dir.x, dir.y, 0.3))


P.S (I didnt categorize the topic cause i coulnt decide weither it was bug or lvl help)

Try to use something other than Nalfar (or nearestEnemy) to create your Vector

Ill try his bullet. (20 chars)

Nope its the same thing. I can reflect it but it doesnt damage him

Can you post your new code?

code
# Use hero.reflect() to reflect back Nalfar's projectiles!
while True:
    bullet = hero.findNearest(hero.findEnemyMissiles())
    enemy = hero.findNearestEnemy()
    if bullet:
        dir = Vector.subtract(bullet.pos, hero.pos).normalize()
        hero.reflect(Vector(dir.x,dir.y,0.3))


This is unnecesary as you aren’t using it anymore

No need to normalize it

the z shouldn’t be 0.3, try numbers between 1.5 and 2, that should work

Thank you @Aya i removed the normalize and it worked! But i realized something. It only works when we hit nalfar’s feet…

1 Like

You’re welcome (20chars)

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.