py_yugi_clone/scripts/camera.py
2024-07-12 22:04:31 +02:00

11 lines
389 B
Python

import pygame
import numpy as np
from scripts.utils import to_isometric_pixel
class Camera:
def __init__(self, game, scroll = np.array([0.,0.])):
self.scroll = scroll
self.game = game
def update(self):
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