2024-07-12 22:04:31 +02:00
|
|
|
import pygame
|
|
|
|
import numpy as np
|
|
|
|
from scripts.utils import to_isometric_pixel
|
|
|
|
|
2024-07-17 00:08:42 +02:00
|
|
|
class CameraPlayerLess:
|
2024-07-12 22:04:31 +02:00
|
|
|
def __init__(self, game, scroll = np.array([0.,0.])):
|
|
|
|
self.scroll = scroll
|
|
|
|
self.game = game
|
2024-07-17 00:08:42 +02:00
|
|
|
def update(self, delta):
|
|
|
|
self.scroll += delta
|
|
|
|
|
|
|
|
class Camera(CameraPlayerLess):
|
|
|
|
#def __init__(self, game, scroll = np.array([0.,0.])):
|
|
|
|
# self.scroll = scroll
|
|
|
|
# self.game = game
|
2024-07-12 22:04:31 +02:00
|
|
|
def update(self):
|
2024-07-17 00:08:42 +02:00
|
|
|
super().update((to_isometric_pixel(self.game.player.pos-np.array([48,80]))*np.array([1,0.5]) - np.array(self.game.display.get_size())/2 - self.scroll)/30)
|
|
|
|
#self.scroll += (to_isometric_pixel(self.game.player.pos-np.array([48,80]))*np.array([1,0.5]) - np.array(self.game.display.get_size())/2 - self.scroll)/30
|
|
|
|
|