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 )
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)
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() p = pbge.createPlane( 0,0,-2 ) pbge.scale( p, 10,10,1 ) pbge.createOscReceiver( 23000 )
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() p = pbge.createPlane(0, 0, -2) pbge.scale(p, 10, 10, 1) pbge.createOscReceiver(23000)
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() pbge.myplane = pbge.createPlane(0, 0, -3) pbge.mycube = pbge.createCube(0, 2, 0) pbge.myspot = pbge.createSpot(0, 0, 7) pbge.scale(pbge.myplane, 10)
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() pbge.myplane = pbge.createPlane( 0,0,-3 ) pbge.mycube = pbge.createCube( 0,0,0 ) pbge.myspot = pbge.createSpot( 0,0,7 ) pbge.scale( pbge.myplane, 10 ) pbge.speed = 0.07
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)
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)
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 )
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)
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() # changing background color pbge.background(0, 0, 0) # storing the reference of the created objects # into 'pbge' to animate them later pbge.myplane = pbge.createPlane(0, 0, -3) pbge.mycube = pbge.createCube(0, 2, 0) pbge.mysphere = pbge.createSphere(0, -2, 0) pbge.mycylinder = pbge.createCylinder(2, 0, 0) pbge.myspot = pbge.createSpot(0, 0, 7) pbge.scale(pbge.myplane, 10) pbge.scale(pbge.mycylinder, 0.3, 0.3, 4) pbge.scaleZ(pbge.mycube, 2) # changing objects color pbge.changeColor(pbge.myplane, 255, 0, 0) pbge.changeColor(pbge.mycube, 0, 255, 255) pbge.changeColor(pbge.mysphere, 255, 0, 255) pbge.changeColor(pbge.mycylinder, 255, 255, 255)
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() # changing background color pbge.background( 0,0,0 ) # storing the reference of the created objects # into 'pbge' to animate them later pbge.myplane = pbge.createPlane( 0,0,-3 ) pbge.mycube = pbge.createCube( 0,2,0 ) pbge.mysphere = pbge.createSphere( 0,-2,0 ) pbge.mycylinder = pbge.createCylinder( 2,0,0 ) pbge.myspot = pbge.createSpot( 0,0,7 ) pbge.scale( pbge.myplane, 10 ) pbge.scale( pbge.mycylinder, 0.3, 0.3, 4 ) pbge.scaleZ( pbge.mycube, 2 ) # creation of a custom variable pbge.color = 0 pbge.way = 1
from ProcessingBGE.ProcessingBGE import ProcessingBGE as pbge if pbge.isconfigured(): co = bge.logic.getCurrentController() #TODO
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() # storing the reference of the created objects # into 'pbge' to animate them later pbge.myplane = pbge.createPlane( 0,0,-3 ) pbge.mycube = pbge.createCube( 0,2,0 ) pbge.mysphere = pbge.createSphere( 0,-2,0 ) pbge.mycylinder = pbge.createCylinder( 2,0,0 ) pbge.myspot = pbge.createSpot( 0,0,7 ) pbge.scale( pbge.myplane, 10 ) pbge.scale( pbge.mycylinder, 0.3, 0.3, 4 ) pbge.scaleZ( pbge.mycube, 2 )
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() # getting the reference of the created objects # for further modifications myplane = pbge.createPlane( -2,0,0 ) mycube = pbge.createCube( 0,2,0 ) mysphere = pbge.createSphere( 0,-2,0 ) mycylinder = pbge.createCylinder( 2,0,0 ) #let's place a spot myspot = pbge.createSpot( 0,0,7 ) # all objects are created, # let's change the position: pbge.moveTo( myplane, 0,0,-3 ) # let's change the size: pbge.scale( myplane, 10 ) pbge.scaleZ( mycube, 3 ) # let's change the orientation: pbge.rotateX( mycylinder, 15 )
scene.post_draw = [animate] pbge.configure() # getting the reference of the created objects # for further modifications myplane = pbge.createPlane( -2,0,0 ) mycube = pbge.createCube( 0,2,0 ) mysphere = pbge.createSphere( 0,-2,0 ) mycylinder = pbge.createCylinder( 2,0,0 ) #let's place a spot myspot = pbge.createSpot( 0,0,7 ) # all objects are created, # let's change the position: pbge.moveTo( myplane, 0,0,-3 ) # let's change the size: pbge.scale( myplane, 10 ) pbge.scaleZ( mycube, 3 ) # let's change the orientation: pbge.rotateX( mycylinder, 15 ) # called at each frame def animate(): pbge.update() # always leave this at the bottom of the script! if pbge.isconfigured() == False: init()
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure() # basic 3D objects pbge.createPlane( -2,0,0 ) pbge.createCube( 0,2,0 ) pbge.createSphere( 0,-2,0 ) pbge.createCylinder( 2,0,0 ) #let's place a spot pbge.createSpot( 0,0,7 )
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 )
def animate(): pbge.update()
def init(): scene = bge.logic.getCurrentScene() scene.post_draw = [animate] pbge.configure()
from ProcessingBGE.ProcessingBGE import ProcessingBGE as pbge if pbge.isconfigured(): co = bge.logic.getCurrentController() mouse = co.sensors["Mouse"] # position pbge.mouseX = mouse.position[0] / bge.render.getWindowWidth() pbge.mouseY = mouse.position[1] / bge.render.getWindowHeight() # buttons lb = mouse.getButtonStatus(bge.events.LEFTMOUSE) mb = mouse.getButtonStatus(bge.events.MIDDLEMOUSE) rb = mouse.getButtonStatus(bge.events.RIGHTMOUSE) if lb == bge.logic.KX_INPUT_NONE or lb == bge.logic.KX_INPUT_JUST_RELEASED: pbge.mouseLeft = False else: pbge.mouseLeft = True if mb == bge.logic.KX_INPUT_NONE or mb == bge.logic.KX_INPUT_JUST_RELEASED: pbge.mouseMiddle = False else: pbge.mouseMiddle = True if rb == bge.logic.KX_INPUT_NONE or rb == bge.logic.KX_INPUT_JUST_RELEASED: pbge.mouseRight = False else: pbge.mouseRight = True