Added alot of things, waypoints, grid for editor, game camera system, enemy moving on pre defined waypoint (path)

This commit is contained in:
2026-06-07 22:46:47 +02:00
parent 6283fb0d5a
commit 0171a5c845
23 changed files with 432 additions and 77 deletions
+26
View File
@@ -0,0 +1,26 @@
import pygame as pg
class Camera():
def __init__(self):
self.zoom = 1
self.offset = pg.math.Vector2(0, 0)
def world_to_screen(self, pos):
return (
int((pos[0] - self.offset.x) * self.zoom),
int((pos[1] - self.offset.y) * self.zoom)
)
def screen_to_world(self, pos):
return (
pos[0] / self.zoom + self.offset.x,
pos[1] / self.zoom + self.offset.y
)
def move(self, dx, dy):
self.offset.x += dx
self.offset.y += dy
def change_zoom(self, amount):
self.zoom += amount
self.zoom = max(0.5, min(self.zoom, 4.0))