Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-01-04 18:10:53 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-01-04 18:10:53 (GMT)
commitca2ca7dea2097e5decf8a1d68bb38dfd2bfc12f6 (patch)
treef5a1349283bf2b8625ada8464bc7bd209c5da378
parent6f9d3659509f9b9307d38c751519051722128803 (diff)
v1
-rw-r--r--game.py46
1 files changed, 19 insertions, 27 deletions
diff --git a/game.py b/game.py
index 70f672d..6769f2f 100644
--- a/game.py
+++ b/game.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
#Copyright (c) 2011-12 Walter Bender
-#Copyright (c) 2012 Ignacio Rodríguez
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -75,19 +74,19 @@ class Game():
self._colors.append('#000000')
self._colors.append('#FF0000')
- self._colors.append('#FF4040')
self._colors.append('#FF8080')
self._colors.append('#FFa0a0')
+ self._colors.append('#FFc0c0')
self._colors.append('#FFFF00')
- self._colors.append('#FFFF40')
self._colors.append('#FFFF80')
self._colors.append('#FFFFa0')
+ self._colors.append('#FFFFe0')
self._colors.append('#0000FF')
- self._colors.append('#4040FF')
self._colors.append('#8080FF')
self._colors.append('#80a0FF')
+ self._colors.append('#c0c0FF')
self._canvas = canvas
if parent is not None:
@@ -300,7 +299,7 @@ Now rub on another one of the yellow dots.')
self._next = self._shake_it_more
self._shake = 'random'
self._pausing = True
- GObject.timeout_add(10000, self._clear_pause)
+ GObject.timeout_add(5000, self._clear_pause)
GObject.timeout_add(100, read_accelerometer, self)
def _shake_it_more(self):
@@ -308,28 +307,25 @@ Now rub on another one of the yellow dots.')
self._next = self._turn_left
self._shake = 'random2'
self._pausing = True
- GObject.timeout_add(10000, self._clear_pause)
+ GObject.timeout_add(5000, self._clear_pause)
def _turn_left(self):
self._lightbg.set_label('See what happens if you turn it to the left.')
self._next = self._turn_right
self._shake = 'left'
self._pausing = True
- GObject.timeout_add(10000, self._clear_pause)
def _turn_right(self):
self._lightbg.set_label('Now turn it to the right.')
self._next = self._align
- self._shake = 'right'
self._pausing = True
- GObject.timeout_add(10000, self._clear_pause)
+ self._shake = 'right'
def _align(self):
self._lightbg.set_label('Shake it some more.')
self._next = self._tap_six
- self._shake = 'align'
self._pausing = True
- GObject.timeout_add(10000, self._clear_pause)
+ self._shake = 'align'
def _tap_six(self):
self._shake = None
@@ -337,11 +333,12 @@ Now rub on another one of the yellow dots.')
if self._tapped == None:
self._tapped = []
if self._dots[self._release].type != YELLOW:
- self._lightbg.set_label('Press all of the yellow dots.')
+ self._lightbg.set_label('Press the yellow dots.')
return
else:
if not self._release in self._tapped:
self._tapped.append(self._release)
+ self._dots[self._release].set_label(':)')
if len(self._tapped) == 6:
self._darkbg.set_layer(100)
self._lightbg.set_layer(0)
@@ -351,12 +348,6 @@ Now rub on another one of the yellow dots.')
self._darkbg.set_label('Press all of the yellow dots again!')
self._tapped = None
self._next = self._tap_six_too
- else:
- if len(self._tapped) == 5:
- self._lightbg.set_label('Only one more yellow dot to press!')
- else:
- self._lightbg.set_label("That's good. \
-Keep pressing the yellow dots.")
def _tap_six_too(self):
self._shake = None
@@ -369,6 +360,7 @@ Keep pressing the yellow dots.")
else:
if not self._release in self._tapped:
self._tapped.append(self._release)
+ self._dots[self._release].set_label('')
if len(self._tapped) == 6:
self._lightbg.set_layer(100)
self._darkbg.set_layer(0)
@@ -383,12 +375,6 @@ Keep pressing the yellow dots.")
'Tap on the two dots that switched positions.')
self._tapped = None
self._next = self._tap_two
- else:
- if len(self._tapped) == 5:
- self._lightbg.set_label('Only one more yellow dot to press.')
- else:
- self._lightbg.set_label("That's good. \
-Keep pressing the yellow dots.")
def _tap_two(self):
self._shake = None
@@ -400,6 +386,7 @@ Keep pressing the yellow dots.")
else:
if not self._release in self._tapped:
self._tapped.append(self._release)
+ self._dots[self._release].set_label(':)')
if len(self._tapped) == 2:
pos1 = self._dots[self._targets[1]].get_xy()
pos2 = self._dots[self._targets[2]].get_xy()
@@ -410,6 +397,8 @@ Keep pressing the yellow dots.")
self._next = self._shake_three
# Since we don't end up in the button press
GObject.timeout_add(500, self._next)
+ for i in self._tapped:
+ self._dots[i].set_label('')
elif len(self._tapped) == 1:
self._lightbg.set_label('You found one. Now find the other one.')
@@ -504,6 +493,7 @@ Keep pressing the yellow dots.")
blue += 1
if docked:
self._lightbg.set_label('Interesting.')
+ self._pausing = False
elif self._shake == 'left':
right = False
for dot in self._dots:
@@ -529,6 +519,7 @@ Keep pressing the yellow dots.")
right = True
if not right:
self._lightbg.set_label('Hmm')
+ self._pausing = False
elif self._shake == 'right':
left = False
for dot in self._dots:
@@ -554,9 +545,10 @@ Keep pressing the yellow dots.")
left = True
if not left:
self._lightbg.set_label('Hmm')
- if self._pausing is not True:
+ self._pausing = False
+ if not self._pausing:
if self._next is not None:
- GObject.timeout_add(500, self._next)
+ GObject.timeout_add(1000, self._next)
else:
self._lightbg.set_label('')
self._shake = None
@@ -621,7 +613,7 @@ Keep pressing the yellow dots.")
if self._dots.index(spr) == target:
self._release = target
if self._next is not None:
- GObject.timeout_add(500, self._next)
+ GObject.timeout_add(200, self._next)
def _smile(self):
for dot in self._dots: