I've been trying to get my object to be animated for only 6 seconds. Can't get my head round it. Any suggestions?
Here's my code for those that are interested/ having the same problem. It uses functions for the mouse being pressed, and the animation of the object.
Rem Project: 3D PLATFORMER
Rem Created: Thursday, December 24, 2009
Rem ***** Main Source File *****
//INITIALISE
randomize timer() : set display mode 800,600,32 : sync on : sync rate 30 :set text size 30
//INITIALISE VARS
dim MousePressed(10,2)
CamX = 0
CamY = 0
CamZ = 0
begunAnimatedTime = 0
//LOAD MEDIA
load object "C:\Program Files\The Game Creators\Dark Basic Professional\Projects\DIG\DIG Media\Media\dwarf1.X", 10
position object 10, 0,0,0
position camera CamX, CamY+10, CamZ
point camera 0 ,0 ,0 ,0
do
//TIMER CONTROL
TimeNow = (Timer())
//MOUSE CONTROL
MOUSEPUSH()
//PLAYER CONTROL`Mouse pressed, Arrow keys pressed.
PLAYERCONTROL()
//HEALTH ADJUSTMENTS`Loop through player and closest enemies draw a floating FF7 style HP loss.
sync
loop
function PLAYERCONTROL()
if MousePressed(7,2)=1 //mouse pressed
//animate attack mode
ANIMATE(112.0, 126.0) `(startFrame#, endFrame#)
//get closest enemy within facing direction, make em' glow.
endif
//IF any arrow keys are pressed
If ((((keystate(200)= 1) || (keystate(203)= 1) || (keystate(205)= 1) || (keystate(208)= 1)) && (clicked=0)))
//animate walking mode
If (begunAnimatedTime <> begunAnimatedTime + 6000)
begunAnimatedTime = TimeNow
ANIMATE(2.0, 14.0) `(startFrame#, endFrame#)
`begunAnimatedTime = 0
Endif
Endif
endfunction
Function ANIMATE(startFrame#, endFrame#)
loop object 10, startFrame#, endFrame#
Endfunction
Function MOUSEPUSH()
`mouseclick()
MousePressed(7,1)=MousePressed(7,0)
MousePressed(7,0)=mouseclick()
`NOT PRESSED
if MousePressed(7,0)=0 and MousePressed(7,1)=0 then MousePressed(7,2)=0
`INITIAL PRESS
if MousePressed(7,0)=1 and MousePressed(7,1)=0 then MousePressed(7,2)=1
`HELD DOWN
if MousePressed(7,0)=1 and MousePressed(7,1)=1 then MousePressed(7,2)=2
`JUST RELEASED
if MousePressed(7,0)=0 and MousePressed(7,1)=1 then MousePressed(7,2)=3
Endfunction