Okay then, check this out:
`AI Container Demo and Physics Character Controller Demo
`Mashed together by BMacZero
`Basic Setup
sync on : sync rate 0 : autocam off
position camera 0,100,-30
point camera 0,0,0
`Start AI
AI Start
AI Set Radius 2.5
`Start Physics
phy start
`Make player
make object cone 1,5
xrotate object 1,90
fix object pivot 1
color object 1,rgb(0,255,0)
position object 1,0,2.5,-30
AI Add Player 1
phy make box character controller 1, 0, 10, 0, 2.5, 2.5, 2.5, 1, 1.5, 45.0
`Make the level
`Floor
make object box 100,100,1,100
position object 100,0,-0.5,0
color object 100,rgb(128,128,128)
phy make rigid body static box 100
`Make ground floor boundary obstacle, encloses the space to keep the entity in
AI Start New Obstacle
AI Add Obstacle Vertex -50,-50
AI Add Obstacle Vertex 38,-50
AI Add Obstacle Vertex 38,50
AI Add Obstacle Vertex -50,50
AI End New Obstacle 0,1
`Random box obstacles
for i=1 to 10
make object box 100+i,rnd(10)+3,5+rnd(10)/10.0,rnd(10)+3
position object 100+i,rnd(80)-45,2.5,rnd(80)-40
yrotate object 100+i,rnd(360)
color object 100+i,rgb(rnd(200),rnd(200),rnd(200))
AI Add Static Obstacle 100+i
phy make rigid body static box 100+i
next i
AI Complete Obstacles
`Add some enemies
for i=2 to 4
make object cone i,5
xrotate object i,90
fix object pivot i
position object i,rnd(80)-40,2.5,rnd(80)-40
color object i,rgb(255,0,0)
AI Add Enemy i,1,0
AI Set Entity Aggressive i
next i
do
`Move the player with arrowkeys
` turn the object left when the left key is pressed
if leftkey ( )
turn object left 1, 0.2
endif
` turn the object right when the right key is pressed
if rightkey ( )
turn object right 1, 0.2
endif
` apply a force to move the controller when the up key is pressed
if upkey ( )
phy move character controller 1, 1.0
else
phy move character controller 1, 0.0
endif
`Display directions
set cursor 0,0
print "Use The Arrow Keys To Move"
print
print "FPS: ";screen fps()
`Update everything
phy update
AI Update
sync
loop
What I did here was basically just mash together the DarkAI Container example and the DarkPHYSICS character controller example, and clean them up.