This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from random import randint, choice | |
from math import cos, sin | |
screen_size = Size(768, 1024) | |
score = 0 | |
def update_score(n=1): | |
global score | |
if n == 'reset': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
class MyScene (Scene): | |
def setup(self): | |
self.lines = [] | |
def touch_began(self, touch): | |
x = touch.location.x | |
y = touch.location.y | |
self.xybegin = Point(x,y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
class MyScene (Scene): | |
def setup(self): | |
self.xybegin = Point(0,0) | |
self.lines = [] | |
def draw(self): | |
background(0, 0, 0) | |
fill(0, 0, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
# Written by Sebastian Jarsve | |
from scene import * | |
from sound import * | |
from random import randint, uniform | |
from math import sin | |
GAME_PLAYING = 1 | |
GAME_DEAD = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from sound import play_effect | |
from PIL import Image | |
import urllib, cStringIO | |
class StartPhoto(object): | |
def __init__(self): | |
self.title = 'Python' | |
self.link = 'http://imgs.xkcd.com/comics/python.png' | |
self.file = Image.open(cStringIO.StringIO(urllib.urlopen(self.link).read())).convert('RGBA') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Created by Sebastian Jarsve | |
# 9. April 2013 | |
from scene import * | |
from sound import play_effect | |
from random import randint | |
def centered_rect(x, y, w, h): | |
return Rect(x-w/2, y-h/2, w, h) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
from scene import * | |
from math import sqrt, pi | |
import sound | |
button_pad = [['ans', 'pi', 'sqrt(', '%'], | |
['(', ')', '*', '/'], | |
['7', '8', '9', '-'], | |
['4', '5', '6', '+'], | |
['1', '2', '3', '='], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from random import randint | |
screen_size = Size() | |
class Ball (object): | |
def __init__(self, pos=None, size=Size(70, 70), c=(1,0,0)): | |
load_image('White_Circle') | |
if pos is None: | |
pos = Point(randint(0, screen_size.w), randint(0, screen_size.h)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Conway's game of life. | |
# Touch cells to give them life. | |
# Tap screen with two fingers to pause/un-pause. | |
# Tap screen with three fingers to give life to random cells. | |
from scene import * | |
from PIL import Image, ImageDraw | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from random import choice | |
def opposite(d): | |
return (d[0]*-1, d[1]*-1) | |
def sub_tuples(a, b): | |
return (a[0]-b[0], a[1]-b[1]) | |
def add_tuples(a, b): |
OlderNewer