Пример #1
0
    def __init__(self, batch, group, character, sprite_base):
        group = pyglet.graphics.OrderedGroup(10, group)

        self.character = character
        self.last_sprite_index = 0

        self.sprites = list()
        # 0-3 : left,right,top,bottom
        # 4-7 : walk; left,right,top,bottom
        # 8   : idle

        # stationary
        self.sprites.append(
            pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_left'),
                                 batch=batch,
                                 group=group))
        self.sprites.append(
            pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_right'),
                                 batch=batch,
                                 group=group))
        self.sprites.append(
            pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_top'),
                                 batch=batch,
                                 group=group))
        self.sprites.append(
            pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base +
                                                       '_bottom'),
                                 batch=batch,
                                 group=group))

        # walk
        self.sprites.append(
            sprite.AnimatedSprite(imagecache.get_animation(sprite_base +
                                                           '_walk_left'),
                                  batch=batch,
                                  group=group))
        self.sprites.append(
            sprite.AnimatedSprite(imagecache.get_animation(sprite_base +
                                                           '_walk_right'),
                                  batch=batch,
                                  group=group))
        self.sprites.append(
            sprite.AnimatedSprite(imagecache.get_animation(sprite_base +
                                                           '_walk_top'),
                                  batch=batch,
                                  group=group))
        self.sprites.append(
            sprite.AnimatedSprite(imagecache.get_animation(sprite_base +
                                                           '_walk_bottom'),
                                  batch=batch,
                                  group=group))

        #idle
        self.sprites.append(
            sprite.AnimatedSprite(imagecache.get_animation(sprite_base +
                                                           '_idle'),
                                  batch=batch,
                                  group=group))
Пример #2
0
 def __init__(self, batch, group, parent, image, rotation=0, order=5):
     group = pyglet.graphics.OrderedGroup(order, group)
     self.sprite = pyglet.sprite.Sprite(imagecache.get_sprite(image),
                                        batch=batch,
                                        group=group)
     self.sprite.rotation = rotation
     self.parent = parent
Пример #3
0
    def __init__(self, batch, group, character, sprite_base):
        group = pyglet.graphics.OrderedGroup(10, group)

        self.character = character
        self.last_sprite_index = 0

        self.sprites = list()
        # 0-3 : left,right,top,bottom
        # 4-7 : walk; left,right,top,bottom
        # 8   : idle

        # stationary
        self.sprites.append(pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_left'),
                                                 batch = batch,
                                                 group = group))
        self.sprites.append(pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_right'),
                                                 batch = batch,
                                                 group = group))
        self.sprites.append(pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_top'),
                                                 batch = batch,
                                                 group = group))
        self.sprites.append(pyglet.sprite.Sprite(imagecache.get_sprite(sprite_base + '_bottom'),
                                                 batch = batch,
                                                 group = group))

        # walk
        self.sprites.append(sprite.AnimatedSprite(imagecache.get_animation(sprite_base + '_walk_left'),
                                                  batch = batch,
                                                  group = group))
        self.sprites.append(sprite.AnimatedSprite(imagecache.get_animation(sprite_base + '_walk_right'),
                                                  batch = batch,
                                                  group = group))
        self.sprites.append(sprite.AnimatedSprite(imagecache.get_animation(sprite_base + '_walk_top'),
                                                  batch = batch,
                                                  group = group))
        self.sprites.append(sprite.AnimatedSprite(imagecache.get_animation(sprite_base + '_walk_bottom'),
                                                  batch = batch,
                                                  group = group))

        #idle
        self.sprites.append(sprite.AnimatedSprite(imagecache.get_animation(sprite_base + '_idle'),
                                                  batch = batch,
                                                  group = group))
Пример #4
0
    def __init__(self, batch, group):
        self.sprite = pyglet.sprite.Sprite(imagecache.get_sprite('title'),batch=batch,
                                           group=pyglet.graphics.OrderedGroup(0, group))
        self.text = pyglet.text.Label(
            "ENTER",
            batch = batch,
            group = pyglet.graphics.OrderedGroup(10, group),
            font_name = "Courier New",
            color = (230,169,149,255),
            font_size = 36)

        self.fire = sprite.AnimatedSprite(imagecache.get_animation('girl_walk_right'),batch=batch,
                                           group=pyglet.graphics.OrderedGroup(10, group))
Пример #5
0
    def __init__(self, batch, group, dialog):
        self.batch = batch
        self.group = group

        self.dialog = dialog

        self.dialog_background = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_bg'),
            batch=batch,
            group=pyglet.graphics.OrderedGroup(0))
        self.dialog_name_background = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_name_bg'),
            batch=batch,
            group=pyglet.graphics.OrderedGroup(1))
        self.dialog_next = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_next'),
            batch=batch,
            group=pyglet.graphics.OrderedGroup(2))

        self.text = None
        self.name_text = None

        self.new_text()
Пример #6
0
    def __init__(self, batch, group, dialog):
        self.batch = batch
        self.group = group

        self.dialog = dialog

        self.dialog_background = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_bg'),
            batch = batch,
            group = pyglet.graphics.OrderedGroup(0))
        self.dialog_name_background = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_name_bg'),
            batch = batch,
            group = pyglet.graphics.OrderedGroup(1))
        self.dialog_next = pyglet.sprite.Sprite(
            imagecache.get_sprite('dialog_next'),
            batch = batch,
            group = pyglet.graphics.OrderedGroup(2))

        self.text = None
        self.name_text = None

        self.new_text()
Пример #7
0
    def __init__(self, batch, group):
        self.sprite = pyglet.sprite.Sprite(imagecache.get_sprite('title'),
                                           batch=batch,
                                           group=pyglet.graphics.OrderedGroup(
                                               0, group))
        self.text = pyglet.text.Label("ENTER",
                                      batch=batch,
                                      group=pyglet.graphics.OrderedGroup(
                                          10, group),
                                      font_name="Courier New",
                                      color=(230, 169, 149, 255),
                                      font_size=36)

        self.fire = sprite.AnimatedSprite(
            imagecache.get_animation('girl_walk_right'),
            batch=batch,
            group=pyglet.graphics.OrderedGroup(10, group))
Пример #8
0
    def __init__(self, batch, group, hud):
        self.hud = hud

        self.normal = [
            pyglet.sprite.Sprite(imagecache.get_sprite('fire_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('water_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('wind_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('earth_hud'), batch = batch, group = group) ]

        self.pressed = [
            pyglet.sprite.Sprite(imagecache.get_sprite('fire_pressed_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('water_pressed_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('wind_pressed_hud'), batch = batch, group = group),
            pyglet.sprite.Sprite(imagecache.get_sprite('earth_pressed_hud'), batch = batch, group = group) ]

        for s in self.normal:
            s.scale = self.scale
        for s in self.pressed:
            s.scale = self.scale
Пример #9
0
    def __init__(self, batch, group, hud):
        self.hud = hud

        self.normal = [
            pyglet.sprite.Sprite(imagecache.get_sprite('fire_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('water_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('wind_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('earth_hud'),
                                 batch=batch,
                                 group=group)
        ]

        self.pressed = [
            pyglet.sprite.Sprite(imagecache.get_sprite('fire_pressed_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('water_pressed_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('wind_pressed_hud'),
                                 batch=batch,
                                 group=group),
            pyglet.sprite.Sprite(imagecache.get_sprite('earth_pressed_hud'),
                                 batch=batch,
                                 group=group)
        ]

        for s in self.normal:
            s.scale = self.scale
        for s in self.pressed:
            s.scale = self.scale
Пример #10
0
 def __init__(self, batch, group, parent, image, rotation = 0, order = 5):
     group = pyglet.graphics.OrderedGroup(order, group)
     self.sprite = pyglet.sprite.Sprite(imagecache.get_sprite(image), batch = batch, group = group)
     self.sprite.rotation = rotation
     self.parent = parent