camchenry / super_shooter

A retro arcade shooter made with LÖVE.
MIT License
8 stars 3 forks source link

a dead enemy can still damage you #5

Closed Nuthen closed 8 years ago

Nuthen commented 8 years ago

caused either when self.position is directly set, or when self.acceleration is not set

it seems that this works:

local position = vector(
        math.cos(self.angle) * self.orbitRadius,
        math.sin(self.angle) * self.orbitRadius
    )

    self.moveTowardsPlayer = (self.start - self.position + position):normalized()
    self.acceleration = (self.moveTowardsPlayer):normalized() * self.speed

but this does not work:

self.position = self.start + vector(
        math.cos(self.angle) * self.orbitRadius,
        math.sin(self.angle) * self.orbitRadius
    )

perhaps directly setting the position does not allow the entity to be removed from the quadtree?

camchenry commented 8 years ago

This should be fixed in commit b2b93d076a7dd9e3b6352528e9eec5be4d6bc48c