Welcome to mirror list, hosted at ThFree Co, Russian Federation.

scripttemplate_gamelogic_basic.py « scripts « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fd404d5c8a45f17e5975c224c7d8d01b39fdc7f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!BPY
"""
Name: 'GameLogic Template'
Blender: 249
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.owner
	
	sens = cont.sensors['mySensor']
	actu = cont.actuators['myActuator']
	
	if sens.positive:
		cont.activate(actu)
	else:
		cont.deactivate(actu)

main()
'''

new_text = bpy.data.texts.new('gamelogic_simple.py')
new_text.write(script_data)
bpy.data.texts.active = new_text
Window.RedrawAll()