diff --git a/help/index.html b/help/index.html index 0dd6ea4..77c0c83 100644 --- a/help/index.html +++ b/help/index.html @@ -47,8 +47,6 @@

Sprite FunctionsBrief description __init__()Initilizes a sprite. - show()Show the sprite. - hide()Hide the sprite. changeXBy()Change the sprite's X Position by (amount). changeYBy()Change the sprite's X Position by (amount). goTo()Go to a X and Y position. @@ -65,6 +63,8 @@

Sprite VariablesBrief description + Sprite.showSet to "True" to show the sprite, set to "False" to hide it. Replaces "show()" and "hide()". Other FunctionsBrief description setup()Sets up PyGame and returns a screen object that can be used with blit(). blit()Draw all graphic changes on the screen. This must be called to display graphics. diff --git a/slither/__init__.py b/slither/__init__.py index cbc20dc..240d542 100644 --- a/slither/__init__.py +++ b/slither/__init__.py @@ -103,7 +103,7 @@ def __init__(self): self.xpos = 0 # X Position self.ypos = 0 # Y Position self.direction = 0 # Direction is how much to change the direction, hence why it starts at 0 and not 90 - self.showing = True + self.show = True self.scale = 1 # How much to multiply it by in the scale self.zindex = 0 # How high up are we in the "z" axis? sprites.append(self) # Add this sprite to the global list of sprites @@ -120,14 +120,6 @@ def zindex(self, val): self._zindex = val reorderSprites() - def show(self): - '''Show the sprite.''' - self.showing = True - - def hide(self): - '''Hide the sprite.''' - self.showing = False - def goto(self, xpos, ypos): '''Go to xpos, ypos.''' self.xpos = xpos @@ -139,8 +131,9 @@ def moveSteps(self, numSteps): self.ypos + math.sin(math.radians(self.direction)) * numSteps) def isVisible(self): - '''Check if the object is visible, not just showing.''' - return self.showing and self.scale > 0 + '''Check if the object is visible, not just showing. + This is better than Sprite.show because it also checks the scale.''' + return self.show and self.scale > 0 def delete(self): '''Remove the sprite from the global sprites list, causing it not to be drawn.'''