I started reflective shield and started by writing this code, which succeeds in reflecting the projectiles, but it sends them much to high (screenshot 1).
while True: nalfar = hero.findNearestEnemy() dir = Vector.subtract(nalfar.pos, hero.pos) dir = Vector.normalize(dir) hero.reflect(dir)
Then, I tried to do change the dir.z property in the same way as it’s done in the code example, and it threw up this error (screenshot 2):
while True: nalfar = hero.findNearestEnemy() dir = Vector.subtract(nalfar.pos, hero.pos) dir = Vector.normalize(dir) dir.z = 0.3 hero.reflect(dir)
I managed to complete the level by entering the z value in a dictionary with x and y as dir.x and dir.y. Also the z value does require fine tuning to 0.1 increments to get the right angle to deal damage to Nalfar.
The reflect ability does obviously work, but I think the reflect ability documentation should be changed so that the code doesn’t cause an error.
Does anyone else see this in this level, or any other levels when using relfect()?