Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-08-22 21:20:52 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-08-22 21:20:52 (GMT)
commita8b8f856120ebde13c4703e3aa460594822cc56f (patch)
treeec28e9637873287ecd6fd1af2f24435a5b0d93b0 /src/api
parent9a62679e89ad1fbc0954ba5bdb378b6c132c04ec (diff)
more cleans and fixes
Diffstat (limited to 'src/api')
-rwxr-xr-xsrc/api/Game.py23
-rwxr-xr-xsrc/api/GameState.py5
-rwxr-xr-xsrc/api/Sprite.py18
-rwxr-xr-xsrc/api/Sprite2.py6
-rwxr-xr-xsrc/api/SuperSprite.py18
5 files changed, 27 insertions, 43 deletions
diff --git a/src/api/Game.py b/src/api/Game.py
index 40b61f6..b1901bd 100755
--- a/src/api/Game.py
+++ b/src/api/Game.py
@@ -58,10 +58,11 @@ class CGame(object):
self.mMousePointerSprite.destroy()
self.mMousePointerSprite = None
self.mInstance = None
- # destroy pygame
- #pygame.quit()
+
pygame.mouse.set_visible(True)
- print "destroy"
+ # destroy pygame
+ pygame.quit()
+ print "destroy Game"
def init(self):
print "init pygame..."
@@ -108,8 +109,6 @@ class CGame(object):
if event.key == pygame.K_ESCAPE:
self.mQuit = True
- #self.doEvents(event)
-
self.mMouse.update()
self.mMousePointerSprite.setXY(self.mMouse.getX(), self.mMouse.getY())
@@ -131,19 +130,7 @@ class CGame(object):
self.mClock.tick(30)
#print ("FPS: %.0f" % self.mClock.get_fps())
- def doEvents(self, event):
- """ overwrite this method to add your own events.
- works like normal event handling, passes event
- object
- """
- pass
-
-# def setSprites(self, aSpritesArray):
-# self.mSprites = aSpritesArray
- #self.mGroups = []
- #self.mMainSprites = pygame.sprite.OrderedUpdates(self.mSprites)
- #self.mGroups.append(self.mMainSprites)
-
+
# Add a sprite to the sprite list.
def addChild(self, aSprite, aLayer=0):
self.mAllSprites.remove(self.mMousePointerSprite)
diff --git a/src/api/GameState.py b/src/api/GameState.py
index 42c09c7..ffba526 100755
--- a/src/api/GameState.py
+++ b/src/api/GameState.py
@@ -8,9 +8,6 @@ class CGameState(object):
def update(self):
pass
#print "CGameState update"
-
- #def render(self):
- # print "CGameState render"
-
+
def destroy(self):
print "CGameState destroy"
diff --git a/src/api/Sprite.py b/src/api/Sprite.py
index 92ef3e1..5ba7796 100755
--- a/src/api/Sprite.py
+++ b/src/api/Sprite.py
@@ -236,14 +236,14 @@ class CSpriteOLD(pygame.sprite.Sprite):
self.mSpeed = self.maxSpeed
#TODO
- def setAngle(self, dir):
+ def setAngle(self, direction):
""" sets both the direction of motion
and visual rotation to the given angle
If you want to set one or the other,
set them directly. Angle measured in degrees
"""
- self.mAngle = dir
- self.mRotation = dir
+ self.mAngle = direction
+ self.mRotation = direction
#---------------------------------------------------------------------------
# turnBy().
@@ -391,7 +391,7 @@ class CSpriteOLD(pygame.sprite.Sprite):
radians = math.atan2(dy, dx)
self.mAngle = radians / math.pi * 180
- def setSpeedLimits(self, max, min):
+ def setSpeedLimits(self, amax, amin):
""" determines maximum and minimum
speeds you will allow through
speedUp() method. You can still
@@ -400,8 +400,8 @@ class CSpriteOLD(pygame.sprite.Sprite):
max: 10
min: -3
"""
- self.maxSpeed = max
- self.minSpeed = min
+ self.maxSpeed = amax
+ self.minSpeed = amin
def dataTrace(self):
""" utility method for debugging
@@ -481,9 +481,9 @@ class CSpriteOLD(pygame.sprite.Sprite):
dy *= -1
radians = math.atan2(dy, dx)
- dir = radians * 180 / math.pi
- dir += 180
- return dir
+ direction = radians * 180 / math.pi
+ direction += 180
+ return direction
#TODO: no hay scene, ver como agarra el background...
def drawTrace(self, color=(0x00, 0x00, 0x00)):
diff --git a/src/api/Sprite2.py b/src/api/Sprite2.py
index 59711f5..ea35cfb 100755
--- a/src/api/Sprite2.py
+++ b/src/api/Sprite2.py
@@ -120,7 +120,7 @@ class CSprite(pygame.sprite.Sprite):
self.mPos.setX(position.getX())
self.mPos.setY(position.getY())
- def setSpeedLimits(self, max, min):
+ def setSpeedLimits(self, amax, amin):
""" determines maximum and minimum
speeds you will allow through
speedUp() method. You can still
@@ -129,8 +129,8 @@ class CSprite(pygame.sprite.Sprite):
max: 10
min: -3
"""
- self.maxSpeed = max
- self.minSpeed = min
+ self.maxSpeed = amax
+ self.minSpeed = amin
def dataTrace(self):
""" utility method for debugging
diff --git a/src/api/SuperSprite.py b/src/api/SuperSprite.py
index d044541..2dee0ea 100755
--- a/src/api/SuperSprite.py
+++ b/src/api/SuperSprite.py
@@ -176,14 +176,14 @@ class CSuperSprite(pygame.sprite.Sprite):
if self.speed > self.maxSpeed:
self.speed = self.maxSpeed
- def setAngle(self, dir):
+ def setAngle(self, direction):
""" sets both the direction of motion
and visual rotation to the given angle
If you want to set one or the other,
set them directly. Angle measured in degrees
"""
- self.dir = dir
- self.rotation = dir
+ self.dir = direction
+ self.rotation = direction
def turnBy (self, amt):
""" turn by given number of degrees. Changes
@@ -312,7 +312,7 @@ class CSuperSprite(pygame.sprite.Sprite):
radians = math.atan2(dy, dx)
self.dir = radians / math.pi * 180
- def setSpeedLimits(self, max, min):
+ def setSpeedLimits(self, amax, amin):
""" determines maximum and minimum
speeds you will allow through
speedUp() method. You can still
@@ -321,8 +321,8 @@ class CSuperSprite(pygame.sprite.Sprite):
max: 10
min: -3
"""
- self.maxSpeed = max
- self.minSpeed = min
+ self.maxSpeed = amax
+ self.minSpeed = amin
def dataTrace(self):
""" utility method for debugging
@@ -393,9 +393,9 @@ class CSuperSprite(pygame.sprite.Sprite):
dy *= -1
radians = math.atan2(dy, dx)
- dir = radians * 180 / math.pi
- dir += 180
- return dir
+ direction = radians * 180 / math.pi
+ direction += 180
+ return direction
def drawTrace(self, color=(0x00, 0x00, 0x00)):
""" traces a line between previous position