Exemplo n.º 1
0
def animate():
    pbge.update()

    # keyboard interactions

    # use 'f' for faster and 's' for slower
    # done only once when the key is pressed
    if (pbge.keyPressed('f')):
        pbge.speed *= 2
        pbge.moveTo(pbge.myspot, 0, 0, 7 + pbge.speed * 10)

    if (pbge.keyPressed('s')):
        pbge.speed *= 0.5
        pbge.moveTo(pbge.myspot, 0, 0, 7 + pbge.speed * 10)

    # use 'r' to reset the cube position
    if (pbge.keyPressed('r')):
        pbge.moveTo(pbge.mycube, 0, 0, 0)

    # use the arrows to move the cube
    if (pbge.keyActive(pbge.ARROW_UP)):
        pbge.move(pbge.mycube, 0, pbge.speed, 0)

    if (pbge.keyActive(pbge.ARROW_DOWN)):
        pbge.move(pbge.mycube, 0, -pbge.speed, 0)

    if (pbge.keyActive(pbge.ARROW_LEFT)):
        pbge.move(pbge.mycube, -pbge.speed, 0, 0)

    if (pbge.keyActive(pbge.ARROW_RIGHT)):
        pbge.move(pbge.mycube, pbge.speed, 0, 0)
Exemplo n.º 2
0
def animate():
    pbge.update()
    
    # keyboard interactions
    
    # use 'f' for faster and 's' for slower
    # done only once when the key is pressed
    if ( pbge.keyPressed( 'f' ) ):
        pbge.speed *= 2
        pbge.moveTo( pbge.myspot, 0, 0, 7 + pbge.speed * 10 )

    if ( pbge.keyPressed( 's' ) ):
        pbge.speed *= 0.5
        pbge.moveTo( pbge.myspot, 0, 0, 7 + pbge.speed * 10 )
    
    # use 'r' to reset the cube position
    if ( pbge.keyPressed( 'r' ) ):
        pbge.moveTo( pbge.mycube, 0, 0, 0 )
    
    # use the arrows to move the cube
    if ( pbge.keyActive( pbge.ARROW_UP ) ):
        pbge.move( pbge.mycube, 0, pbge.speed, 0 )
    
    if ( pbge.keyActive( pbge.ARROW_DOWN ) ):
        pbge.move( pbge.mycube, 0, -pbge.speed, 0 )
        
    if ( pbge.keyActive( pbge.ARROW_LEFT ) ):
        pbge.move( pbge.mycube, -pbge.speed, 0, 0 )
    
    if ( pbge.keyActive( pbge.ARROW_RIGHT ) ):
        pbge.move( pbge.mycube, pbge.speed, 0, 0 )
Exemplo n.º 3
0
def animate():
    pbge.update()

    # and rotation of objects
    pbge.rotateZ(pbge.myplane, 0.001)
    pbge.rotateX(pbge.mycube, 0.01)
    pbge.rotateY(pbge.mysphere, 0.02)
    pbge.rotateY(pbge.mycylinder, 0.03)
Exemplo n.º 4
0
def animate():
    pbge.update()
    
    # and rotation of objects
    pbge.rotateZ( pbge.myplane, 0.001 )
    pbge.rotateX( pbge.mycube, 0.01 )
    pbge.rotateY( pbge.mysphere, 0.02 )
    pbge.rotateY( pbge.mycylinder, 0.03 )
Exemplo n.º 5
0
def animate():
    pbge.update()

    # using the XY mouse position to move the cube
    mx = -5 + pbge.mouseX * 10
    my = 5 - pbge.mouseY * 10
    pbge.moveTo(pbge.mycube, mx, my, 0)
    pbge.moveTo(pbge.myspot, mx * 0.3, my * 0.3, 7)
Exemplo n.º 6
0
def animate():
    pbge.update()

    pbge.color += pbge.way
    # inverting way once the color is 0 or 255
    if (pbge.color == 0 or pbge.color == 255):
        pbge.way *= -1

    pbge.changeColor(pbge.mycube, pbge.color, 0, 0)
    pbge.moveTo(pbge.mysphere, 0, 0, pbge.color / 127)
Exemplo n.º 7
0
def animate():
    pbge.update()
    
    pbge.color += pbge.way
    # inverting way once the color is 0 or 255
    if ( pbge.color == 0 or pbge.color == 255 ):
        pbge.way *= -1
    
    pbge.changeColor( pbge.mycube, pbge.color,0,0 )
    pbge.moveTo( pbge.mysphere, 0,0, pbge.color / 127 )
Exemplo n.º 8
0
def animate():
    pbge.update()