# ... 9 = 348,156 # # Blue: # 0 = 204, 220 # 1 = 220, 220 # 9 = 348, 220 # Purple: # 9 = 348, 284 return( h ) # ================================================================================ if __name__ == '__main__': # Use the SpriteSheet.exploresheet() method to display the sprites & determine their coords: if False: ss = SpriteSheet( 'sprite_sheets/frogger.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) grid = Ledgrid() grid.exploreSheet( ss ) grid.clear() grid.close() sys.exit(0) # Use the AnimationSequence.addFrame() method to define a sequences of images for an animation: if True: frogger_ss = FroggerSheet( ) dur = 150 seq1 = AnimationSequence("seq1") seq1.addFrame( frogger_ss, 'SwimmingTurtle1', duration_ms=dur ) seq1.addFrame( frogger_ss, 'SwimmingTurtle2', duration_ms=dur ) seq1.addFrame( frogger_ss, 'SwimmingTurtle3', duration_ms=dur ) seq1.addFrame( frogger_ss, 'SwimmingTurtle2', duration_ms=dur )
#!/usr/bin/env python ''' ledgrid_test.py - test script for writing to PRU 0 mem using PyPRUSS library & driving ledgrid.''' import sys from Ledgrid import * options = ['pacman', 'frogger', 'mrs_pacman', 'mario', 'minecraft'] if sys.argv[1] not in options: print 'Please pass one of the following args on the cmdline: ', options print ' you passed: ', sys.argv[1] exit( -1 ) selected = sys.argv[1] if( selected == 'pacman' ): ss = SpriteSheet( 'sprite_sheets/pacman_spritesheet.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) elif( selected == 'mrs_pacman' ): ss = SpriteSheet( 'sprite_sheets/mrs_pacman_16x16.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) elif( selected == 'minecraft' ): ss = SpriteSheet( 'sprite_sheets/MinecraftSheet_24x20.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) elif( selected == 'frogger' ): ss = SpriteSheet( 'sprite_sheets/frogger.png', stepx=16, stepy=16, offsetx=32, offsety=32 ) elif( selected == 'mario' ): ss = SpriteSheet( 'sprite_sheets/mario_sheet.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) grid = Ledgrid() grid.exploreSheet( ss ) grid.clear() grid.close() sys.exit(0)
sizex = 16 crop_box = (x1,y1,x1+sizex,y1+sizey) letter_img = img1.crop( crop_box ) #ni.paste( letter_img, (idx*sizex, 0, (idx+1)*sizex, sizey) ) ni.paste( letter_img, (paste_loc_x, 0, paste_loc_x+sizex, sizey) ) paste_loc_x += sizex return( ni ) # ================================================================================ if __name__ == '__main__': if False: debug = True tb = TextBuilder(); string_image = tb.createStringImage( "CORY STEWART", debug ); grid = Ledgrid() grid.showWideImage( string_image, duration_ms=6, printinfo=debug ) grid.clear() grid.close() sys.exit(0) if True: debug = False tb = TextBuilder(); string_image = tb.createFroggerStringImage( " F R O G G E R ", debug ); grid = Ledgrid() grid.showWideImage( string_image, duration_ms=0, printinfo=debug ) grid.clear() grid.close() sys.exit(0)
# self.defineSprite( '200pts', 0, 112 ) self.defineSprite( '400pts', 16, 112 ) self.defineSprite( '800pts', 32, 112 ) self.defineSprite( '1600pts', 48, 112 ) self.defineSprite( 'ghost_invisible_eyes_up', 64, 112 ) self.defineSprite( 'ghost_invisible_eyes_down', 80, 112 ) self.defineSprite( 'ghost_invisible_eyes_left', 96, 112 ) self.defineSprite( 'ghost_invisible_eyes_right', 112, 112 ) return( h ) # ================================================================================ if __name__ == '__main__': # Use the SpriteSheet.exploresheet() method to display the sprites & determine their coords: if False: ss = SpriteSheet( 'sprite_sheets/mrs_pacman_16x16.png', stepx=16, stepy=16, offsetx=0, offsety=0 ) grid = Ledgrid() grid.exploreSheet( ss ) grid.clear() grid.close() sys.exit(0) # Use the AnimationSequence.addFrame() method to define a sequences of images for an animation: if True: mrspacman_ss = MrsPacmanSheet( ) seq1 = AnimationSequence("seq1") dur = 200 seq1.addFrame( mrspacman_ss, 'pacman_right_open1', duration_ms=dur ) seq1.addFrame( mrspacman_ss, 'pacman_right_open2', duration_ms=dur ) seq1.addFrame( mrspacman_ss, 'pacman_right_closed', duration_ms=dur )