Pick a animation frame?

Game Editor comments and discussion.

Pick a animation frame?

Postby HillBilly » Sat Dec 02, 2006 5:49 am

Is there any way I can pick a specific frame in a animation?

What I would like is to have a spinning object, but I want to have a random number pick 1 frame of the animation, like animation frame #12 and that would be that object.
HillBilly
 
Posts: 68
Joined: Thu Jun 08, 2006 4:31 am
Location: OHIO, USA
Score: 4 Give a positive score

Postby Joshua Worth » Sat Dec 02, 2006 7:25 am

frameindex is the variable name
Stay sweet
User avatar
Joshua Worth
 
Posts: 515
Joined: Tue Jul 19, 2005 12:00 am
Location: Stralia
Score: 5 Give a positive score

Postby Novice » Sat Dec 02, 2006 1:24 pm

Joshua Worth wrote:frameindex is the variable name


I think you meant "animpos".
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby HillBilly » Sat Dec 02, 2006 2:49 pm

OK, can I talk you into some kind of example. The online manual does not say much about this command. :?
HillBilly
 
Posts: 68
Joined: Thu Jun 08, 2006 4:31 am
Location: OHIO, USA
Score: 4 Give a positive score

Postby Novice » Sat Dec 02, 2006 3:49 pm

On create actor or any other event use this code
Code: Select all
animpos=round(rand(nframes));

before that you have to change animation direction to stopped to avoid flickering.
You can replace nframes with any number you wish, this way it takes the number of frames your animation has. So if your animation has 10 frames you will get a random frame from 0 to 9 (the first frame counts as 0).
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Joshua Worth » Sat Dec 02, 2006 10:31 pm

Novice wrote:
Joshua Worth wrote:frameindex is the variable name


I think you meant "animpos".
sorry, i forgot
Stay sweet
User avatar
Joshua Worth
 
Posts: 515
Joined: Tue Jul 19, 2005 12:00 am
Location: Stralia
Score: 5 Give a positive score

Postby Novice » Sun Dec 03, 2006 1:05 am

No problem :wink:
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby HillBilly » Sun Dec 03, 2006 3:13 am

That works great. THANKS for the help.
HillBilly
 
Posts: 68
Joined: Thu Jun 08, 2006 4:31 am
Location: OHIO, USA
Score: 4 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest