Merge pull request 'get coords on mouse click' (#12) from get_coords_on_click_event into master

Reviewed-on: #12
This commit is contained in:
Jędrzej Wesołowski 2022-04-07 20:16:54 +02:00
commit ea8ae08414

View File

@ -1,3 +1,4 @@
from calendar import c
import pygame as pg import pygame as pg
import sys import sys
from os import path from os import path
@ -6,6 +7,7 @@ from map import *
# from house import House # from house import House
from sprites import * from sprites import *
from settings import * from settings import *
import math
class Game(): class Game():
@ -101,6 +103,10 @@ class Game():
self.quit() self.quit()
if event.key == pg.K_h: if event.key == pg.K_h:
self.draw_debug = not self.draw_debug 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): def show_start_screen(self):
pass pass