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
在OnInit裡

application.setCurrentUserScene ( "Scene" )
application.setCurrentUserActiveCamera( application.getCurrentUserSceneTaggedObject("攝影機名"))

在onKeyboardKeyDown(kKeyCode)裡
if(kKeyCode == input.kKeyW)
then
this.bMove_Front (true)
user.postEvent ( application.getCurrentUser ( ),0.1,"AI名","onMove_Front")
end


在onKeyboardKeyUp(kKeyCode)裡
if(kKeyCode == input.kKeyW)
then
this.bMove_Front (false)

end

在onMove_Front ( )裡
if (this.bMove_Front ( ) == true)
then
object.translate(application.getCurrentUserSceneTaggedObject("坦克名"),0,0,-0.1,object.kLocalSpace)

user.postEvent ( application.getCurrentUser ( ),0.1,"AI名","onMove_Front")
end