Skip to content

Commit

Permalink
Fix HoverText lifespan
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Mathews committed Aug 21, 2011
1 parent dbdf9ca commit e1ac013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import spritesheet
from wordwrap import render_textrect

DEBUG = False
DEBUG = True

WALLS = [(0,0,0)]
TILE_SIZE = 20
Expand Down Expand Up @@ -274,7 +274,8 @@ def __init__(self, x, y):
self.flicker_tick = 0

if DEBUG:
self.items = ["escaper"]
# self.items = ["escaper"]
self.items = []
else:
self.items = []

Expand Down Expand Up @@ -410,19 +411,18 @@ def update(self, keys, game_map, game):
Updater.add_updater(HoverText("I can't without a target.", self, 0))
return

if self.x < target.x:
flipped_x = ABS_MAP_SIZE - (float(self.x)/target.x) * (ABS_MAP_SIZE - target.x)
else:
flipped_x = target.x - (float(self.x - target.x)/(ABS_MAP_SIZE - target.x)) * (target.x)

flipped_x = int(flipped_x)
flipped_x = int(target.x * 2 - self.x)

# Flip code. Probably should move to new function
self.ghost.move(flipped_x, self.y)
if UpKeys.key_up(27):
if abs(flipped_x - self.x) < TILE_SIZE + 1 and self.has_replicator():
Updater.add_updater(HoverText("My own dead body would kill me!", self, 0))
return

if flipped_x < 0 or flipped_x > ABS_MAP_SIZE:
Updater.add_updater(HoverText("I can't see there!", self, 0))
return

old_coords = (self.x, self.y)

Expand Down Expand Up @@ -910,7 +910,7 @@ def __init__(self, text, follow, depth=0):
self.text = text
self.follow = follow
self._depth = depth
self.lifespan = 200
self.lifespan = len(text) * 2

def depth(self):
return self._depth
Expand Down
Binary file modified map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e1ac013

Please sign in to comment.