Ejemplo n.º 1
0
    def makeBoom(self):
        print('boom')

        selfEnt = coreInstance.entities[self.ownerId]

        toErase = []
        [toErase.append(other.id) for other in coreInstance.entities.values()
         if distanceBetweenPoints(other.pos, selfEnt.pos) < 0.3]

        [coreInstance.deleteEntity(idToErase) for idToErase in toErase]
def WalkerSystem(keyword):
    for entityId in coreInstance.tagToEntityIdGroup[keyword]:
        entity = coreInstance.entities[entityId]
        if not entity.walker.destinationPos: continue

        delta_vector_normalized = deltaVectorNormalized(entity.walker.destinationPos, entity.pos)
        entity.deltaVector = [x * entity.walker.speed for x in delta_vector_normalized]

        if distanceBetweenPoints(entity.pos, entity.walker.destinationPos) < 0.03:
            entity.deltaVector = [x * 0.1 for x in entity.deltaVector]
            entity.walker.destinationPos = None
Ejemplo n.º 3
0
 def distance(self, currentPos):
     return distanceBetweenPoints(self.position, currentPos) - self.radius
Ejemplo n.º 4
0
 def collision(self, currentPos):
     distance_between_points = distanceBetweenPoints(currentPos, self.position)
     if distance_between_points < self.radius:
         return CollisionData(self.color, deltaVectorNormalized(currentPos, self.position))