hexbattle /

#!/usr/bin/env python2
# encoding: utf-8

"""The intro scene."""

# shared data
from core import core, __copyright__
# event scheduling functions → interactivity
from pyglet.clock import schedule, schedule_once, schedule_interval

from pyglet.window import key
from pyglet import image
from core import Sprite, run

### Things needed for the scene

IMAGE_BLOB = "graphics/blob.png"

### Movement

def blob_update(blob): 
    """Update the blob position."""
    x, y, dx, dy = blob.x, blob.y, blob.dx, blob.dy
    # If we hit an edge, we turn around and spawn another blob which can't be controlled. 
    if y < 0:
        dy *= -1
        y += 1 # makes sure we don't "stick"
    elif y + blob.height > 
        dy *= -1
        y -= 1
    if x < 0: 
        dx *= -1
        x += 1
    elif x + blob.width >
        dx *= -1
        x -= 1

    # continuous movement
    x += dx
    y += dy
    blob.x, blob.y, blob.dx, blob.dy = x, y, dx, dy

### Visible things
#: visible gets used by the start function to draw all visible items.
visible = []
blob = Sprite(image_path=IMAGE_BLOB, x=212, y=208)

# give it some random velocity
from random import random
blob.dy = 3*random()
blob.dx = 3*random()

### The base function for updating the scene
def update(dt=0): 
    """Update the stats of all scene objects. 

Don't blit them, though. That's done by the Game itself.

To show something, add it to the visible list. 

def start(dt):
    """Start the scene."""
    # make all visible items show themselves 
    # anytime the screen is refreshed
    def on_draw():
        for i in visible:

    # update the scene every 10ms - independent of showing the scene
    schedule_interval(update, 0.01)

if __name__ == "__main__":