Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Sprites - Looping animations  (Read 5050 times)

0 Members and 1 Guest are viewing this topic.

Varrok

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
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 Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
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. ::wave

Varrok

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
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 Offline
  • Gender: Male
  • Posts: 48
    • View Profile
    • Čurina
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 Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
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
  1. on "FrameChanged"
  2. {
  3.   if(this.CurrentFrame == this.NumFrames - 1) this.CurrentFrame = 9;
  4. }
  5.  

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. ::wave

Varrok

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
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 Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
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. ::wave

Varrok

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: Sprites - Looping animations
« Reply #7 on: February 05, 2009, 08:46:51 AM »

Thx so much! It solved the problem... ;D
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 Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
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. ::wave
 

Page created in 0.046 seconds with 21 queries.