# Bouncer example (BlitEngine/WiFiBoyMini)
# 2018.09.09, tklua@wifiboy.org

x = []; y = []; dx = []; dy = []
for i in range(5):
    x.append(wb.rand(0,88))
    y.append(wb.rand(0,120))
    dx.append(wb.rand(1,3))
    dy.append(wb.rand(1,3))

while True:
    wb.blitbuf() # clear offscreen buffer
    for i in range(5):
        x[i] += dx[i]
        if x[i] > 89 or x[i] < 0: dx[i] = -dx[i]; 
        y[i] += dy[i]
        if y[i] > 120 or y[i] < 0: dy[i] = -dy[i]; 
        wb.blitimg(96, x[i], y[i], 39, 7)
    wb.blit() # disply out
    