Permalink
Browse files

added variable to force player to stop

  • Loading branch information...
1 parent 211f1a9 commit 7becb6a82947f1941cbc0aebace063d275256ef7 @tpwrules committed Apr 14, 2012
Showing with 7 additions and 3 deletions.
  1. +4 −1 data.py
  2. +2 −1 game.py
  3. +1 −1 player.py
View
@@ -18,10 +18,13 @@ def get_node_text(node, strip_newlines=True): #get all the text from a node
def get_xml_prop(root, name, strip_newlines=True): #get the text from a "property" node with the given name
try:
- return get_node_text(root.getElementsByTagName(name)[0], strip_newlines)
+ return get_node_text(get_node(root, name), strip_newlines)
except:
return None
+def get_node(root, name): #find a node with a given name
+ return root.getElementsByTagName(name)[0]
+
def get_path(path, with_data=True): #convert a path to one appropriate for the host with the data directory
path = path.replace("\\", "/") #convert backslashes to forward slashes
if with_data: #if we're prepending the data directory
View
@@ -29,6 +29,7 @@ def __init__(self, g):
self.default_dialog = dialog.Dialog(self.g, "standard")
self.dialog = None
self.font = self.default_dialog.dlog_font
+ self.stopped = False #set when things should stop moving
self.dialog_drawing = False #set when the dialog is showing text
self.dialog_result = None #hold result of a dialog
self.dialog_callback = None #callback for dialog completion
@@ -167,7 +168,7 @@ def update(self): #update the engine for this frame
self.debug = not self.debug #invert debug flag
if self.g.curr_keys[settings.key_menu]: #if the menu key is pressed
#if no transition is happening and the menu isn't already being shown
- if self.curr_transition is None and self.menu_showing is False and self.dialog_drawing is False:
+ if self.curr_transition is None and self.menu_showing is False and self.dialog_drawing is False and self.stopped is False:
self.menu.show() #show menu
self.menu_showing = True #and mark it as being shown
#center camera on player
View
@@ -145,7 +145,7 @@ def update(self):
else: #if we are
self.animator.update() #update animation
return #don't do anything else
- if self.game.dialog_drawing: #if a dialog is currently being shown
+ if self.game.dialog_drawing or self.game.stopped: #if a dialog is currently being shown
return #don't do anything
if self.g.keys[settings.key_up]: #if up is pressed
self.move(0) #move up

0 comments on commit 7becb6a

Please sign in to comment.