예제 #1
0
    "file": "goomba.gif",
    "fps": 1,
    "x": 60
}, {
    "file": "qblock.gif",
    "fps": 5,
    "x": 80
}]

sign = farnsworth.sign(provides_logo=False,
                       is_dynamic=True,
                       preferred_duration=5.0)

for gif in gifs:
    gif["file"] = sign.locate_file(gif["file"])
    gif["sprite"] = farnsworth.sprite(gif_source=gif["file"],
                                      scale_y_to=config.PIXELS_HIGH)
    gif["sprite"].move_to(gif["x"], 0)
    gif["clock"] = farnsworth.clock(1.0 / gif["fps"])

while True:

    sign.front_layer().blank()

    for gif in gifs:
        if gif["clock"].tick():
            gif["sprite"].advance_image()
        gif["sprite"].paint(sign.front_layer())

    sign.paint()
예제 #2
0
파일: walker.py 프로젝트: KJ4IPS/farnsworth
walker.add_image( sign.locate_file('06.bmp') )
walker.add_image( sign.locate_file('07.bmp') )
walker.add_image( sign.locate_file('08.bmp') )
walker.add_image( sign.locate_file('09.bmp') )
walker.add_image( sign.locate_file('10.bmp') )
walker.add_image( sign.locate_file('11.bmp') )
walker.add_image( sign.locate_file('12.bmp') )
walker.add_image( sign.locate_file('13.bmp') )
walker.add_image( sign.locate_file('14.bmp') )
walker.add_image( sign.locate_file('15.bmp') )
walker.add_image( sign.locate_file('16.bmp') )

walker.move_to(-10,0)
walker.tween_to(95,0,150)

clock = farnsworth.clock(0.08)

while True:

  sign.front_layer().blank()

  if clock.tick():
    walker.advance_image()
    walker.tween()

  walker.paint( sign.front_layer() )    
  
  sign.paint()

  sleep(0.001)
예제 #3
0
    def set_start_frame(self):
        x = 0
        while x >30:
            x = int(round(30*random.random()))
        return x
   
#================================================================
#sq1=primative_square(3,80,0,0,30,5,5)
#sq2=primative_square(5,2,4,90,120,0,25)
#sq3=primative_square(2,6,13,89,20,2,0)
#sq4=primative_square(2,91,1,20,35,4,7)
#sq5=primative_square(4,12,11,69,12,5,20)
#obs=(sq1,sq2,sq3,sq4,sq5)

gen = generator(25)
clock=farnsworth.clock(.08)
frame = 0
while True:
    
    sign.front_layer().blank()
    
    if clock.tick():
        for ob in gen.obs:
            ob.advance(frame)
        #sq1.advance(frame)
        frame+=1
    
    for ob in gen.obs:
        ob.paint()
    #sq1.paint()
    sign.paint()
예제 #4
0
pellet8 = farnsworth.sprite( sign.locate_file('pellet.bmp') )
pellet8.move_to(60,7)

pellet9 = farnsworth.sprite( sign.locate_file('pellet.bmp') )
pellet9.move_to(68,7)

pellet10 = farnsworth.sprite( sign.locate_file('pellet.bmp') )
pellet10.move_to(76,7)

pellet11 = farnsworth.sprite( sign.locate_file('pellet.bmp') )
pellet11.move_to(84,7)

pellet12 = farnsworth.sprite( sign.locate_file('pellet.bmp') )
pellet12.move_to(92,7)

clock = farnsworth.clock(.075)
#clock = farnsworth.clock(1.5)
frame_count = 0

while True:

  sign.front_layer().blank()

  if clock.tick():
    pacman.cycle_image()
    pacman.tween()
    blinky.cycle_image()
    blinky.tween() 
    print "Blinky = ", blinky._x, blinky._x_inc, blinky._x_float
    print "Pacman = ", pacman._x , pacman._x_inc, pacman._x_float
    #print frame_count
예제 #5
0
                       is_dynamic=True,
                       preferred_duration=5.0)

pacman = farnsworth.sprite(sign.locate_file('pac_man_0.bmp'))
pacman.add_image(sign.locate_file('pac_man_1.bmp'))
pacman.add_image(sign.locate_file('pac_man_2.bmp'))
pacman.move_to(70, 1)

ghost = farnsworth.sprite(sign.locate_file('ghost_1.bmp'))
ghost.add_image(sign.locate_file('ghost_2.bmp'))
ghost.move_to(20, 0)

pellet = farnsworth.sprite(sign.locate_file('pellet.bmp'))
pellet.move_to(93, 7)

clock = farnsworth.clock(0.25)

new_x = 0

while True:

    sign.front_layer().blank()

    if clock.tick():
        pacman.cycle_image()
        ghost.advance_image()

        new_x = new_x - 3
        if new_x < 70:
            new_x = 93
        pellet.move_to(new_x, 7)
예제 #6
0
              { "file": "goomba.gif",
                "fps": 1,
                "x": 60 },
              { "file": "qblock.gif",
                "fps": 5,
                "x": 80 }
            ]

sign = farnsworth.sign( provides_logo=False,
                        is_dynamic=True,
                        preferred_duration=10.0 )

for gif in gifs:
  gif["file"] = sign.locate_file(gif["file"])
  gif["sprite"] = farnsworth.sprite(gif_source=gif["file"], scale_y_to=config.PIXELS_HIGH)
  gif["sprite"].move_to( gif["x"], 0 )
  gif["clock"] = farnsworth.clock( 1.0 / gif["fps"] )

while True:

  sign.front_layer().blank()

  for gif in gifs:
    if gif["clock"].tick():
      gif["sprite"].advance_image()
    gif["sprite"].paint( sign.front_layer() )    

  sign.front_layer().render_string("CENTER","CENTER","FONT_5x5","GIF RENDERING",constants.COLORS['WHITE'] )

  sign.paint()