def draw_square(x, y, size, colour = (255, 255, 255, 0)): # Creates the image. img = image.create(size, size, image.SolidColorImagePattern(colour)) # Draws the image on the canvas. x, y is the top-corner of the image. img.blit(x, y)
+#........................#+ +#........................#+ +##########.....###########+ +++++++++++SSSSS++++++++++++ '''.strip() field_rows = [line.strip() for line in field_cells.splitlines()] cw = ch = 16 hw = hh = 8 map_height = len(field_rows) map_width = len(field_rows[0]) win = window.Window(map_width * cw, map_height * ch) # load / create image resources blank_image = image.create(cw, ch, image.SolidColorImagePattern((200, ) * 4)) wall_image = image.create(cw, ch, image.SolidColorImagePattern((100, ) * 4)) highlight_image = image.create( cw, ch, image.SolidColorImagePattern((255, 255, 255, 100))) enemy_image = image.create(hw, hh, image.SolidColorImagePattern((255, 50, 50, 255))) enemy_image.anchor_x = hw // 2 enemy_image.anchor_y = hh // 2 turret_image = resource.image('basic-gun.png') turret_image.anchor_x = 8 turret_image.anchor_y = 8 bullet_image = image.create(3, 3, image.SolidColorImagePattern((0, 0, 0, 255))) bullet_image.anchor_x = 1 bullet_image.anchor_y = 1