""" import numpy as np #import matplotlib as mpl #mpl.use('TkAgg') #import matplotlib.pyplot as plt import glob import sprites file_list = sorted( glob.glob("/home/pi/Documents/mbed_Graphics/bitmap_sprites/*.bmp")) total_spritesheet = np.zeros( (sprites.sprite_y, sprites.sprite_x * np.size(file_list)), dtype='uint8') for ii in range(0, np.size(file_list)): this_sprite = sprites.bitmap_fix(file_list[ii]) export_sprite = np.left_shift(this_sprite[:, :, 0], 5) + np.left_shift( this_sprite[:, :, 1], 2) + this_sprite[:, :, 2] total_spritesheet[0:sprites.sprite_y, ii * sprites.sprite_x:(ii * sprites.sprite_x) + sprites.sprite_x] = export_sprite disp_sprite = np.zeros( (sprites.sprite_y, sprites.sprite_x * np.size(file_list), 3), dtype='uint8') disp_sprite[:, :, 0] = np.right_shift(total_spritesheet, 5) & 7 disp_sprite[:, :, 1] = np.right_shift(total_spritesheet, 2) & 7 disp_sprite[:, :, 2] = total_spritesheet & 3 disp_sprite_norm = np.zeros(np.shape(disp_sprite), dtype='double') disp_sprite_norm[:, :, 0] = disp_sprite[:, :, 0] / np.max(sprites.rr)
import numpy as np import matplotlib.pyplot as plt import sprites path_in = '/home/pi/Documents/mbed_Graphics/bitmap_maps/room_005.bmp' this_map = sprites.bitmap_fix(path_in) this_map = np.left_shift(this_map[:, :, 0], 5) + np.left_shift( this_map[:, :, 1], 2) + this_map[:, :, 2] npc_map = np.zeros(np.shape(this_map), dtype='uint8') npc_map[2, 2] = 2 npc_map[2, 3] = 3 npc_map[2, 11] = 4 npc_map[2, 12] = 5 npc_map[3, 2] = 6 npc_map[3, 12] = 7 npc_map[5, 5] = 8 npc_map[5, 6] = 9 npc_map[5, 7] = 10 npc_map[5, 8] = 11 npc_map[9, 3] = 12 npc_map[9, 4] = 13 npc_map[11, 2] = 14 npc_map[11, 12] = 15 collide_tile_list = [ 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 56, 57, 58, 59, 60, 68, 80, 84, 93, 94 ] collision_map = np.ones(np.shape(this_map), dtype='uint8')