hi all,
I’ve recently learnt python (it was a module in my university course), I’m writing a simple script to make the title on the title screen of my game rotate a randomly by a small amount. I’ve got a first attempt but its not working, could someone take a quick look at it please?
The title is a mesh object in the scene (converted from a text object), it’s called ‘Title’.
Its the first python I’m coding specifically for a blender game, so its probably just something simple I’m missing:
import bpy
from math import *
import random
Xrot = 90
Yrot = 0
Zrot = 0
Xpos = -3
Ypos = 0
Zpos = 2
while 1==1:
Rand = random.randint(1,3)
RmodX = Rand * 0.5
RmodY = Rand * 0.2
RmodZ = Rand * 0.6
Xrot = Xrot + RmodX
if Xrot >= 95:
RmodX = -RmodX
if Xrot <= 85:
RmodX = -RmodX
Yrot = Yrot + RmodY
if Yrot >= 5:
RmodY = -RmodY
if Yrot <= -5:
RmodY = -RmodY
Zrot = Zrot + RmodZ
if Zrot >= 5:
RmodZ = -RmodZ
if Zrot <= -5:
RmodZ = -RmodZ
bpy.ops.object.Title(loction = (Xpos,Ypos,Zpos), rotation = (Xrot,Yrot,Zrot))
Thanks,
Rich