Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions help/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ <h2 style="font-family: 'Segoe UI', Arial, Sans-Serif;font-weight: 300;color: wh
<tr><td>getCostumeName()</td><td>Get the costume name of a sprite.</td></tr>
<tbody style="background-color: lightgrey"><tr><td><b>Sprite Functions</b></td><td><b>Brief description</b></td></tr></tbody>
<tr><td>__init__()</td><td>Initilizes a sprite.</td></tr>
<tr><td>show()</td><td>Show the sprite.</td></tr>
<tr><td>hide()</td><td>Hide the sprite.</td></tr>
<tr><td>changeXBy()</td><td>Change the sprite's X Position by (amount).</td></tr>
<tr><td>changeYBy()</td><td>Change the sprite's X Position by (amount).</td></tr>
<tr><td>goTo()</td><td>Go to a X and Y position.</td></tr>
Expand All @@ -65,6 +63,8 @@ <h2 style="font-family: 'Segoe UI', Arial, Sans-Serif;font-weight: 300;color: wh
<tr><td>getZIndex()</td><td>Get the sprite's z-index.</td></tr>
<tr><td>isVisible()</td><td>Check if the object is visible, not just showing.</td></tr>
<tr><td>delete()</td><td>Remove the sprite from the global sprites list, causing it not to be drawn.</td></tr>
<tbody style="background-color: lightgrey"><tr><td><b>Sprite Variables</b></td><td><b>Brief description</b></td></tr></tbody>
<tr><td>Sprite.show</td><td>Set to "True" to show the sprite, set to "False" to hide it. Replaces "show()" and "hide()".</td></tr>
<tbody style="background-color: lightgrey"><tr><td><b>Other Functions</b></td><td><b>Brief description</b></td></tr></tbody>
<tr><td>setup()</td><td>Sets up PyGame and returns a screen object that can be used with blit().</td></tr>
<tr><td>blit()</td><td>Draw all graphic changes on the screen. This must be called to display graphics.</td></tr>
Expand Down
15 changes: 4 additions & 11 deletions slither/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.'''
Expand Down