EDIT: Sorry I put this in the wrong thread, I realize this is a thread for literal blender development, not for the python scripting inside… Can someone move this please? Thanks…
Can anyone go through step-by-step of how to make a python script that makes a block move forward unless there is another object in it’s path, then it turns 90 degrees and continues. I am not new to programming, just new to python in blender and such. So I know programming logic, just not the python/blender syntax.
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
if 'Clock' not in own:
own['Clock']=0
else:
if own['Clock']>1 and own['Clock']<=29:
own['Clock']+=1
script = basic header
if you don’t have a property called clock, make it,
How is a timer used in an open loop system? Like I want it to react to any object that is the scene, for appliance of an AI against a player. If you want me to learn the basics, then sure.
Uh, I edited your code a little for testing and I ran into… issues…
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
if 'Clock' not in own:
own['Clock']=0
if 'Drive' not in own:
own['Drive']=0
else:
if own['Clock']>1 and own['Clock']<=29:
own['Clock']+=1
if own['Clock']==29:
own['Drive'] == 1:
The last line has syntax errors… I’m trying to set drive to one, if clock equals 29.
So python is the pickier version of Java? Lol, just kidding java would have busted me for a hundred other reasons… So how can I tell an object to turn and move forward at a certain rate… Now I see where the timer comes in, sorry…
"