From 02d41607b7676afb5b3841e4dc5cdc2d42e84247 Mon Sep 17 00:00:00 2001 From: Anton Laktionov Date: Fri, 29 May 2026 08:17:34 +0300 Subject: [PATCH] Mouse event --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index c88829f..10cacb2 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ def to_iso(tile_list): col = tile.center_x//TILE_WIDTH row = tile.center_y//TILE_HEIGHT tile.center_x = tile.center_x - TILE_WIDTH//2 * (col-row) - tile.center_y = tile.center_y - TILE_HEIGHT//2 * (row+col) + tile.center_y = tile.center_y - TILE_HEIGHT//2 * (col+row) return tile_list class Player(arcade.Sprite): @@ -79,15 +79,15 @@ class MainView(arcade.View): self.players.update(delta_time) def on_mouse_press(self,x,y,but,mod): world_point = self.camera.unproject((x,y)) - tile_col = world_point.x//TILE_WIDTH - tile_row = world_point.y//TILE_HEIGHT + tile_col = world_point.x/TILE_WIDTH + tile_row = world_point.y/TILE_HEIGHT sheet = arcade.load_spritesheet('./assets/tiles/64x64.png') textures = sheet.get_texture_grid((64,64),16,184) self.walls.append( arcade.Sprite( textures[165], - center_x=tile_col*TILE_WIDTH + TILE_WIDTH//2, - center_y=tile_row*TILE_HEIGHT+TILE_HEIGHT + center_x=world_point.x - world_point.x%(TILE_WIDTH//2), + center_y=world_point.y - world_point.y%(TILE_HEIGHT//2) ) )