Panda3D/Exemplos/Tasks

Origem: Wikilivros, livros abertos por um mundo aberto.

Este código faz um texto se mover na horizontal e o outro na vertical, escrito por Maxtremus:

import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
from direct.task.Task import Task


textoHorizontal = OnscreenText("Texto do taskMoverHorizontal")
x = 0.0

def taskMoverHorizontal(task):
	global x
	x += 0.001
	textoHorizontal.setPos(x, 0.0)
	return task.cont


textoVertical = OnscreenText("Texto do taskMoverVertical")
y = 0.0

def taskMoverVertical(task):
	global y
	y += 0.001
	textoVertical.setPos(0.0, y)
	return task.cont
 

taskMgr.add(taskMoverHorizontal, "Mover Horizontal")
taskMgr.add(taskMoverVertical, "Mover Vertical")


run()