get coords on mouse click

This commit is contained in:
happy531 2022-04-07 20:06:09 +02:00
parent 10cca50e63
commit 3a8b3b39ab

View File

@ -1,3 +1,4 @@
from calendar import c
import pygame as pg
import sys
from os import path
@ -6,6 +7,7 @@ from map import *
# from house import House
from sprites import *
from settings import *
import math
class Game():
@ -101,6 +103,10 @@ class Game():
self.quit()
if event.key == pg.K_h:
self.draw_debug = not self.draw_debug
if event.type == pygame.MOUSEBUTTONUP:
pos = pygame.mouse.get_pos()
clicked_coords = [math.floor(pos[0] / TILESIZE), math.floor(pos[1] / TILESIZE)]
print(clicked_coords)
def show_start_screen(self):
pass