Quote: "- How do you call them? (I know you have to use play object, etc.)"
Quote: "- Do you place them all in one function and just call them when you need them?"
Nothing magical here, just play the object frames you want. What I do is setup the player using TYPE variables and assign values to the animations associated with using a particular gun. (Just so you know, I make a different HUD for each gun.) So the TYPE variables' setup is something like this:
type playerData
status, lives, hearts, weapon, damage, ObjNum, char
MinImage, MaxImage
WalkS, WalkE, ThrowS, ThrowE, ShootS, ShootE, ReloadS, ReloadE, ReloadRepS, ReloadRepE
ReloadBackS, ReloadBackE, FromHolsterS, FromHolsterE
ToHolsterS, ToHolsterE
endtype
dim player(4) as playerData
The setup is something like this:
player(aip).ShootS = 14 : player(aip).ShootE = 27
player(aip).ReloadS = 18 : player(aip).ReloadE = 23
player(aip).ReloadRepS = 22 : player(aip).ReloadRepE = 23
player(aip).ReloadBackS = 23 : player(aip).ReloadBackE = 25
player(aip).FromHolsterS = 8 : player(aip).FromHolsterE = 17
player(aip).ToHolsterS = 1 : player(aip).ToHolsterE = 8
Some examples of in-game calls:
if keystate(19) = true and timer() > ReloadTimer : ` R for RELOAD
stop object player(1).ObjNum
set object speed player(1).ObjNum,40
play object player(1).ObjNum,player(1).ReloadS,player(1).ReloadE
player(1).status = 8 : ` reloading
endif
and this:
if mouseclick() = 1 and player(aip).status <> 7 and timer() > BulletTimer
BTU = FindBullet()
if BTU > 0 // is a bullet available?
play sound ShotgunFire : AI Create Sound camera position x(), camera position z(), 255, 800.0
bullet(BTU,2) = 1 : obj = bullet(BTU,1)
if collide > 0 and GotOne = 0
// place the bullet
position object obj,cx#,cy#,cz# : point object obj,camx#,camy#,camz#
show object obj
endif
if GotOne > 0
NPC(GotOne).status = 4 : // dying
AI Kill Entity NPC(GotOne).ObjNum : ` don't let the AI keep moving it
if rnd(100) > 50 : // choose 1 of 2 dying anims
play object NPC(GotOne).ObjNum,NPC(GotOne).Die1Start,NPC(GotOne).Die1End
else
play object NPC(GotOne).ObjNum,NPC(GotOne).Die2Start,NPC(GotOne).Die2End
endif
endif
BulletTimer = timer() + 500
// shotgun recoil
play object player(aip).ObjNum,player(1).ShootS,player(1).ShootE
player(aip).status = 7 : // shot recoil
endif
endif
Anyway, it works well for me.
I rig / animate a HUD in Milkshape, put it into the game and plug in the values for the animations. I make adjustments as needed. I'm sure that others have their way of doing it, but this works for me.