Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Animation Scripts; Animation handeling made easy!
Topic Started: Jun 5 2013, 08:47 PM (572 Views)
Ultimga
Newbie
[ * ]
Hello!

I'm here with some more scripts to make things easier for fellow U3D users, its a small and simple script that will help you
handel animations/play animations for your models!

You call this script in the step event of the object. Specify the start fram, end frame, animation speed,
and whether to play backwards then the object's model will animate if it has animation information in the model.

-Arguments-
Backwards? -> Should the animation play backwards? (True,false)
Speed -> The speed of the animation, 1 being speed that it was made to play at. You can't go lower then 1, but you can go higher.
StartFrame -> What frame does the animation start at?
EndFrame -> What frame does the animation end at?

The script is below the example usage, also attached the script if you can't/don't want to copy+paste.

-----Example-----
Code:
 

if (cPlayer.moving = true)
{
ANIM_BACKWARD = false;
ANIM_SPEED = 1;
FRAME_START = 0;
FRAME_END = 30;
}
else
{
ANIM_BACKWARD = false;
ANIM_SPEED = 1;
FRAME_START = 0;
FRAME_END = 0;
}

UpdateAnimation(ANIM_BACKWARD,ANIM_SPEED,FRAME_START,FRAME_END)


-----SCRIPT-----
Code:
 

//IMPORTANT: Make sure to initalize/decalare the variable _x_ !
//UpdateAnimation(Backwards?,Speed ,StartFrame ,EndFrame )
if (argument0 = false)
{
_x_ += argument1 ;
frame = _x_ + argument2;

if (frame > argument3)
{
frame=argument2;
_x_ = 0;
};
}
else
{
_x_ -= argument1 ;
frame = _x_ + argument3;

if frame < argument2
{
frame = argument3;
_x_ = 0;
};
};
Attached to this post:
Attachments: UpdateAnimation.gml (505 Bytes)
Edited by Ultimga, Jun 5 2013, 08:49 PM.
No Mercy - A indie MMOFPS under development, click me to see the post!
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
Umm
http://s9.zetaboards.com/Ultimate3D_community/topic/7203603/1/#new

I would dismiss this as a cooincedence but our methods are all too similar.
Mine:
EDIT:
//Anim(Reverse?,AnimationSpeed,firstFrame,lastFrame,)
if argument0 = false
{
a+=argument1 ;
frame=a+argument2;
if frame > argument3
{
frame=argument2;
a=0;
}
}else{
a-=argument1 ;
frame=a+argument3;
if frame < argument2
{
frame=argument3;
a=0;
}
}


"Yours"
ards?,Speed ,StartFrame ,EndFrame )
if (argument0 = false)
{
_x_ += argument1 ;
frame = _x_ + argument2;

if (frame > argument3)
{
frame=argument2;
_x_ = 0;
};
}
else
{
_x_ -= argument1 ;
frame = _x_ + argument3;

if frame < argument2
{
frame = argument3;
_x_ = 0;
};
};

I hope I'am not being trolled here or something.


!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
Ultimga
Newbie
[ * ]
Holy crap
They are very similar, thats a huge cooincedence :blink:
I didn't know there was another animation script posted, or I wouldn't have put mine up..

Wow, can't believe they are so similar :think:
No Mercy - A indie MMOFPS under development, click me to see the post!
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Does it matter? It just generic coding.. I've done this method many times.
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
It doesn't. Not trying to say its a big deal it just surprised me. I know its a simple method. If anything it's good to know some of us think alike. :D
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
« Previous Topic · Tutorials and examples · Next Topic »
Add Reply