showing my entire code might help. (I'm using DarkMATTER 2)
Rem Project: Dark doomclone
Rem Created: 6/14/2007 5:40:11 PM
Rem ***** Main Source File *****
rem Initial settings
sync on : sync rate 100
backdrop off : hide mouse
rem Select font
set text font "arial" : set text size 16
set text to bold : set text transparent
rem Loading prompt
sync : center text screen width()/2,screen height()/2,"LOADING" : sync
rem Load all media for game
gosub _load_game
rem Setup all objects for game
gosub _setup_game
rem Game loop
do
rem Control game elements
gosub _control_player
gosub _control_gunandbullet
gosub _control_enemies
rem Update screen
sync
rem End loop
loop
_control_player:
rem Control player direction
rotate camera camera angle x(0)+(mousemovey()/2.0),camera angle y(0)+(mousemovex()/2.0),0
rem Control player movement
cx#=camera angle x(0) : cy#=camera angle y(0)
if keystate(17)=1 then xrotate camera 0,0 : move camera 0,4.5 : xrotate camera 0,cx#
if keystate(31)=1 then xrotate camera 0,0 : move camera 0,-4.5 : xrotate camera 0,cx#
if keystate(30)=1 then yrotate camera 0,cy#-90 : move camera 4.5 : yrotate camera 0,cy#
if keystate(32)=1 then yrotate camera 0,cy#+90 : move camera 4.5 : yrotate camera 0,cy#
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
rem Apply simple gravity to player
position camera camera position x(),camera position y()-1,camera position z()
rem Position listener at player for 3D sound
position listener camera position x(),camera position y(),camera position z()
rotate listener camera angle x(),camera angle y(),camera angle z()
rem In case of restart
if restart=1
restart=0
set bsp collision off 1
rotate camera 0,0,0
position camera 2,2,2
set bsp camera collision 1,0,10,0
set bsp collision height adjustment 1,60
endif
return
_control_gunandbullet:
rem Control gun firing
if mouseclick()=1 and bullet=-50
bullet=100
play sound GunSnd
position object BulletObj,camera position x(0),camera position y(0),camera position z(0)
rotate object BulletObj,camera angle x(0),camera angle y(0),0
set bsp object collision 2,BulletObj,0.1,1
move object BulletObj,0.2
endif
rem Control life of bullet
if bullet>0
rem If bullet collides with BSP world
if bsp collision hit(2)=1 or bulletimpact=1
rem End bullet on wall
bulletimpact=0
bullet=0
else
rem Move bullet
dec bullet
move object BulletObj,35
endif
rem Bullet dies
if bullet=0
set bsp collision off 2
endif
else
rem Gun recharge phase
if bullet>-50 then dec bullet
endif
return
_control_enemies:
rem Basic AI
for ene=11 to 20
if object visible(ene)=1
point object ene,camera position x(0),camera position y(0),camera position z(0)
xrotate object ene,-90
move object down ene,3.5
set object speed ene,7500
loop object ene,570,630
endif
next ene
return
_control_stats:
return
_setup_game:
rem Setup camera
set camera range 1,10000
autocam off
set bsp camera 0
rem Trigger player initialization
restart=1
rem Setup gun for player
lock object on GunObj
scale object GunObj,12,12,14
rotate object GunObj,270,0,0
position object GunObj,0.5,-1.3,2
disable object zdepth GunObj
rem Create object for bullet
BulletObj=3 : make object cube BulletObj,2
rem Create simple sprite based crosshair
sprite 1,640-16,512-16,CrossHairImg
set sprite 1,0,1
return
_load_game:
rem Load BSP world
load bsp "media/world/Dark doomclone.pk3","Dark doomclone.bsp"
rem Load model for gun
GunObj=2 : load object "media/models/Browning.x",GunObj
rem Load models for enemies
`Minotaurs
for Minotaur=11 to 13
load object "media/models/Minotaur.x",Minotaur
append object "media/models/Minotaur.x",Minotaur,total object frames(Minotaur)+1
xrotate object Minotaur,-90 : yrotate object Minotaur,180
scale object Minotaur,125,125,125
next Minotaur
position object 11,175,-120,1050 : position object 12,-175,-120,1075 : position object 13,0,-120,1350
`Zombies
for Zombie=14 to 17
load object "media/models/Zombie.x",Zombie
append object "media/models/Zombie.x",Zombie,total object frames(Zombie)+1
xrotate object Zombie,-90
scale object Zombie,125,125,125
next Zombie
yrotate object 15,90 : yrotate object 16,90
position object 14,-540,-120,1000 : position object 15,-1080,-120,300 : position object 16,-1080,-120,850
position object 17,540,-120,1000
`Bezerkers
for Bezerker=18 to 20
load object "media/models/Bezerker.x",Bezerker
append object "media/models/Bezerker.x",Bezerker,total object frames(Bezerker)+1
xrotate object Bezerker,-90
scale object Bezerker,200,200,200
next Bezerker
yrotate object 20,-90
position object 18,-540,-120,575 : position object 19,540,-120,575 : position object 20,1075,-120,575
rem Load all sounds
GunSnd=1 : load sound "media/sounds/Gun 1.wav",GunSnd
rem Load images
FireImg=1 : load image "media/images/fire.bmp",FireImg
CrossHairImg=1 : load image "media/images/crosshair.bmp",CrossHairImg
return
and here is the animations list:
000 : Stance
000 - 080 : Idle Posture
080 - 150 : Fidget Animation
150 - 200 : Attack (170 Impact)
200 - 250 : Hurt (220 Impact)
250 - 300 : Block/Dodge (270 Impact)
300 - 350 : Stagger
350 - 400 : Collapse/Die (370 Impact)
450 - 500 : Get Up
450 - 550 : Walk
: 450-470 - Position To Loop
: 470-530 - Looping Walk
: 530-550 - Return To Stance
550 - 650 : Run
: 550-570 - Position To Loop
: 570-630 - Looping Run
: 630-650 - Return To Stance
If at first you don't succeed, lower your expectations.