예제 #1
0
from FGAme import World, RegularPoly, draw

world = World()
p = RegularPoly(4, 100, pos=(400, 300), world=world, omega=2, adamping=0.1)
a = draw.Image("gaussiana.png", pos=(400, 300))
world.add(a, layer=-1)
p.torque = lambda t: -p.inertia * p.theta
world.run()
예제 #2
0
from FGAme import World, RegularPoly

world = World()
p = RegularPoly(4, 100, pos=(400, 300), world=world, omega=2, adamping=0.1)
# FIXME: p.external_torque = lambda t: - p.inertia * p.theta
world.run()
예제 #3
0
        j = y / self.tilesize
        return i, j

    @coords.setter
    def coords(self, value):
        self.pos_sw = asvector(value) * self.tilesize + self.tileorigin


if __name__ == '__main__':
    from FGAme import World

    ts = '''
    |            oo
    |        oo     xxxxxxxxxxxxxxxxxx
    |           xxx
    |       xxx
    |                                        ii
    |xxxxxxxxxxxxxxxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    '''

    w = World()
    tm = TileManager((30, 30))
    tm.register_spec('brick', 'x', color='red')
    tm.register_spec('coin', 'o', shape='circle', color='yellow')
    tm.register_spec('spike', 'i', color='black')
    tm.add_tilemap(ts)

    w.add(tm)
    w.run()
예제 #4
0
파일: mainloop.py 프로젝트: diegor2/FGAme
if __name__ == '__main__':
    from FGAme import World, Circle, pos
    w = World()
    c1 = Circle(10, world=w)
    c2 = Circle(10, color='red', world=w)
    c3 = Circle(10, color='blue', world=w)

    @schedule
    def move():
        c2.pos += (1, 1)

    @schedule_iter
    def move_circle():
        for _ in range(50):
            c1.pos += (2, 5)
            yield

    @periodic(1)
    def move_c3():
        c3.pos += (50, 30)

    @delayed(2)
    def move_circle2():
        c1.pos += (1, 0)

    @one_shot(3)
    def move_circle3():
        c1.pos = pos.middle

    w.run()
예제 #5
0
파일: pointer.py 프로젝트: macartur-UNB/BS
from FGAme import Poly, World
from FGAme.draw import RenderTree


class Pointer(RenderTree):

    def __init__(self, button_center, mouse_pos):
        RenderTree.__init__(self)
        vertices = []
        x = button_center[0]
        y = button_center[1]
        vertices.append((x, y + 1))
        vertices.append((x + mouse_pos[0], y + mouse_pos[1]))
        vertices.append((x + mouse_pos[0], y + mouse_pos[1] - 2))
        vertices.append((x, y - 1))

        self.pointer = Poly(vertices, color='white')
        self.add(self.pointer)


if __name__ == '__main__':
    game = World()
    game.add(Pointer())
    game.run()