I created my first game with a model I made by myself but the proble is that the model don't move i the game.
Rem Project: CenfluShooter
Rem Created: 4/09/2010 16:49:44
Rem ***** Main Source File *****
sync on
sync rate 60
hide mouse
autocam off
radius# = 7.0
gravity# = -0.1
slope# = 0.5
ground = 1
jumptimer = 0
gosub makeLevel
gosub makePlayer
do
gosub Animation
gosub MovePlayer
`Change to 3rd person View
if inkey$()="v" and vtimer<timer() then vtimer = timer()+300 : view = 1-view
`Just some random text to show me position etc.
text 0,20,"x rot: "+str$(object angle x(2))
text 0,40,"y rot: "+str$(object angle y(2))
text 0,60,"z rot: "+str$(object angle z(2))
text 0,80,"FPS: "+str$(screen fps())
text 0,100,"Touching Ground: "+str$(ground)
text 0,120,"x = "+str$(object position x(2))
text 0,140,"y = "+str$(object position y(2))
text 0,160,"z = "+str$(object position z(2))
if inkey$() = "q" then end
if shiftkey() = 1 then position object 2,0,50,0
sync
loop
makeLevel:
load object "media/school/school.x",1
return
makePlayer:
make object plain 2,300,300
position object 2,0,500,0
Scale object 2,100,100,100
return
Animation:
if keystate(17) = 1
if walking = 0
loop object 2, 1, 40
walking = 1
endif
else
stop object 2
walking = 0
endif
if keystate(31) = 1
if backwards = 0
loop object 2, 41, 80
backwards = 1
endif
else
stop object 2
backwards = 0
endif
movePlayer:
`Rotate the player with the mouse
yrotate object 2,object angle y(2)+mousemovex()/3.0
xrotate object 2,object angle x(2)+mousemovey()/3.0
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
`Movement and gravity
angy# = object angle y(2)
vx# = 0
vz# = 0
if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if keystate(31)=1 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#)
if keystate(17)=1 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#)
`Only jump if = on ground, and a certain time after last jump
if ground=1
if spacekey()=1 and jumptimer=0 then vy# = vy# + 3.0 : jumptimer = 20
endif
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
if ground = 1 and jumptimer>0 then dec jumptimer
`Position the player
position object 2,x#,oldy#,z#
return