2 gamelogic templates, one with example functions and comments, another minimal template for those who know the api.

This commit is contained in:
2008-09-10 03:34:08 +00:00
parent eaf84d2c25
commit ecc5bdb8d7
2 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#!BPY
"""
Name: 'GameLogic Template'
Blender: 245
Group: 'ScriptTemplate'
Tooltip: 'Basic template for new game logic scripts'
"""
from Blender import Window
import bpy
script_data = \
'''
def main():
cont = GameLogic.getCurrentController()
own = cont.getOwner()
sens = cont.getSensor('mySensor')
actu = cont.getActuator('myActuator')
if sens.isPositive():
GameLogic.addActiveActuator(actu, True)
else:
GameLogic.addActiveActuator(actu, False)
main()
'''
new_text = bpy.data.texts.new('gamelogic_example.py')
new_text.write(script_data)
bpy.data.texts.active = new_text
Window.RedrawAll()