예제 #1
0
def Mirroring(pos):
    Pos = Vec(pos)
    if Pos.x < modelConst.head_radius:
        Pos.x = 2*modelConst.head_radius-Pos.x
    if Pos.y < modelConst.head_radius:
        Pos.y = 2*modelConst.head_radius-Pos.y
    if Pos.x > 800 - modelConst.head_radius:
        Pos.x = 1600 - 2*modelConst.head_radius - Pos.x
    if Pos.y > 800 - modelConst.head_radius: 
        Pos.y = 1600 - 2*modelConst.head_radius - Pos.y 
    return tuple(Pos)
예제 #2
0
	def mr(self,pos,R):
		Pos = Vec(pos)
		L = 800 - R
		if Pos.x < R:
			Pos.x = -Pos.x+2*R
		if Pos.y < R:
			Pos.y = -Pos.y+2*R
		if Pos.x > L:
			Pos.x = 2 * L - Pos.x
		if Pos.y > L:
			Pos.y = 2 * L - Pos.y
		return Pos
예제 #3
0
    def __backoff(self, direction: Vector2):
        if direction == VECTOR2_NULL:
            direction = Vector2(1, 0)
        else:
            direction.normalize_ip()
        direction.y = min(direction.y, .1)
        direction *= EnemySettings.HandToHand.RETREAT_FORCE

        self.apply_force(direction)