April 23, 2024, 03:50:53 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Forum rules
-
please read before posting, it can save you a lot of time.
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Sprites - Looping animations
« previous
next »
Pages: [
1
]
Print
Author
Topic: Sprites - Looping animations (Read 5050 times)
0 Members and 1 Guest are viewing this topic.
Varrok
Lurker
Karma: 0
Offline
Posts: 4
Sprites - Looping animations
«
on:
February 01, 2009, 07:32:50 PM »
Is it possible in WME to loop animation NOT from be first frame, but from... 10? If yes then how?
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Sprites - Looping animations
«
Reply #1 on:
February 02, 2009, 08:07:07 PM »
You'd need to use scripting for that. Sprites are scriptable so you can switch them to any frame programatically.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Varrok
Lurker
Karma: 0
Offline
Posts: 4
Re: Sprites - Looping animations
«
Reply #2 on:
February 03, 2009, 01:35:21 PM »
I guessed that, but how exactly?
Logged
Net
Gripped Software Programmer
Lurker
Karma: 0
Offline
Gender:
Posts: 48
Re: Sprites - Looping animations
«
Reply #3 on:
February 03, 2009, 11:32:31 PM »
By head, I suggest to use
event
attribute of
frame object
of your
sprite
.
Then you'll be able to write some global function, where you may use
GetEvent
of
frame object
, which returns name of the event. So if you enters time value as event, you can use it to make your game automatically detect, if actual animation should be looped from the start or not.
Hope you get the point of this.
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Sprites - Looping animations
«
Reply #4 on:
February 04, 2009, 11:23:07 AM »
Or even simpler, use the FrameChanged event of the sprite.
Attach a new script to your sprite (in SpriteEdit), containing something like (untested):
Code: WME Script
on
"FrameChanged"
{
if
(
this
.
CurrentFrame
==
this
.
NumFrames
-
1
)
this
.
CurrentFrame
=
9
;
}
You'll probably need to add a dummy frame to the end of animation though.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Varrok
Lurker
Karma: 0
Offline
Posts: 4
Re: Sprites - Looping animations
«
Reply #5 on:
February 04, 2009, 03:12:05 PM »
Will I see the difference in SpriteEditor preview?
I attached script properly, but I see no results
At least in SpriteEditor...
«
Last Edit: February 04, 2009, 03:15:04 PM by Varrok
»
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Sprites - Looping animations
«
Reply #6 on:
February 04, 2009, 05:51:36 PM »
No, SpriteEdit doesn't execute scripts.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Varrok
Lurker
Karma: 0
Offline
Posts: 4
Re: Sprites - Looping animations
«
Reply #7 on:
February 05, 2009, 08:46:51 AM »
Thx so much! It solved the problem...
I have an other problem:
I have an animation: "Stand" and i want to start it any time character stops walking, but every time he stops, there is played only last frame of the animation... What should I do?
(Sry 4 bad english, hope u'll understand that...)
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Sprites - Looping animations
«
Reply #8 on:
February 05, 2009, 10:35:27 PM »
Perhaps the
idle actor script
might help you.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Sprites - Looping animations