sprite_all.py

"""Most sprite transformations.
   by stephan)
"""
from slut import *

class Atlantis(World):
    def onSetup(self):
        self.name = "Sprite"
        self.showCoordinates = True

        Polygon(self, 'poly1')
        Polygon(self, 'poly2')
        self.sprites['poly2'].moveBy(-0.5, 0.0, -1.5)


    def onMouseButtonDown(self, event):
        #self.sprites['poly2'].moveBy(1.5, 0, 0)
        #self.sprites['poly2'].rotBy(0, 0, 45)
        #self.sprites['poly2'].scaleBy(0.5, 0.5, 0.5)
        #self.sprites['poly2'].orbitBy(0, 45, 0)

        #self.sprites['poly2'].moveBy(Tween(0.5, 0, 0, 2))
        #self.sprites['poly2'].rotBy(Tween(0, 0, 20, 2))
        #self.sprites['poly2'].scaleBy(Tween(0.5, 0.5, 0.5, 2.3))
        #self.sprites['poly2'].orbitBy(Tween(0, 76, 0, 2))

        #self.sprites['poly2'].moveBy(Thrust(0.0, 0.1, 0.0))
        #self.sprites['poly2'].rotBy(Thrust(10.0, 0.0, 0.0))
        #self.sprites['poly2'].scaleBy(Thrust(0.01, 0.01, 0.01))
        #self.sprites['poly2'].orbitBy(Thrust(0.0, 180.0, 0.0))

        #self.sprites['poly2'].moveTo(0.5, 0, 0)
        #self.sprites['poly2'].rotTo(0, 0, 45)
        #self.sprites['poly2'].scaleTo(1.5, 1.5, 1.5)
        #self.sprites['poly2'].orbitTo(0, -45, 0.0)

        self.sprites['poly2'].moveTo(Tween(0.5, 0, 0, 2))
        self.sprites['poly2'].rotTo(Tween(0, 0, 20, 2))
        self.sprites['poly2'].scaleTo(Tween(1.5, 1.5, 1.5, 2))
        self.sprites['poly2'].orbitTo(Tween(0, 20, 0, 2))


class Polygon(Sprite):
    def onDraw(self):
        glBegin(GL_POLYGON)
        glVertex3f(0.0, 0.0, 0.0)
        glVertex3f(1.0, 0.0, 0.0)
        glVertex3f(1.0, 1.0, 0.0)
        glVertex3f(-0.5, 1.5, 0.0)
        glVertex3f(0.0, 0.0, 0.0)
        glEnd()


atlantis = Atlantis()
atlantis.run()
Initiated by Stephan Hechenberger
Thanks to CADRE's 103