boost
This commit is contained in:
parent
79e51e6ab1
commit
a3bb42751d
1
config
1
config
|
@ -9,3 +9,4 @@ volume = C 0.0 0.0, 36.0 0.61, 120.0 1.0
|
|||
scale = C 0.0 40.0, 850.0 140.0
|
||||
shift-2 = C 0.0 0.0, 840.0 4.2, 2000.0 8.0
|
||||
shift = C 0.0 0.0, 500.0 3.5, 1000.0 6.0
|
||||
boost = L 0.0 0.0, 100.0 4.0
|
||||
|
|
|
@ -162,7 +162,10 @@ class Triangles(GameChild, list):
|
|||
GameChild.__init__(self, parent)
|
||||
list.__init__(self, [])
|
||||
self.display_surface = self.get_display_surface()
|
||||
self.delegate = self.get_game().delegate
|
||||
self.booster = Shift(self, 1, "boost")
|
||||
self.populate()
|
||||
self.subscribe(self.respond)
|
||||
|
||||
def populate(self):
|
||||
if not self:
|
||||
|
@ -177,8 +180,17 @@ class Triangles(GameChild, list):
|
|||
def set_next_gap(self):
|
||||
self.next_gap = randint(210, 380)
|
||||
|
||||
def respond(self, event):
|
||||
compare = self.delegate.compare
|
||||
if compare(event, "down") or compare(event, "down", True):
|
||||
self.booster.active = not event.cancel
|
||||
|
||||
def get_boost(self):
|
||||
return self.booster.get_change()
|
||||
|
||||
def update(self):
|
||||
self.populate()
|
||||
self.booster.update()
|
||||
if self[0].location.collidelist(self.parent.sieve.locations) != -1:
|
||||
sieve = self.parent.sieve
|
||||
if self[0].location.colliderect(sieve.electric.location):
|
||||
|
@ -225,7 +237,8 @@ class Triangle(Sprite):
|
|||
self.location.centerx = self.get_display_surface().get_rect().centerx
|
||||
|
||||
def update(self):
|
||||
self.move(dy=2.45 * self.get_game().acid.get_volume() + 1.6)
|
||||
self.move(dy=2.45 * self.get_game().acid.get_volume() + 1.6 + \
|
||||
self.parent.get_boost())
|
||||
for rect in self.collision_rects:
|
||||
rect.bottom = self.location.bottom
|
||||
Sprite.update(self)
|
||||
|
|
Loading…
Reference in New Issue