Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: About sprite animation  (Read 7960 times)

0 Members and 1 Guest are viewing this topic.

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
About sprite animation
« on: May 04, 2011, 07:30:08 PM »

Hello!

How work Play() and Reset() ?

I have sprite with no loop animation, and i need play it on "LeftClick".
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: About sprite animation
« Reply #1 on: May 05, 2011, 05:52:48 PM »

Can't you simply use entity.PlayAnim() ? Using the sprite scripting methods is an advanced technique and isn't necessary for everyday use.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: About sprite animation
« Reply #2 on: March 03, 2012, 08:28:08 PM »

How to stop animation at a certain frame?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: About sprite animation
« Reply #3 on: March 11, 2012, 10:13:11 AM »

You'd need to attach a script to the sprite and handle the 'FrameChanged' event in it.

Code: WME Script
  1. on "FrameChanged"
  2. {
  3.   if (this.CurrentFrame == 10) this.Pause();
  4. }
  5.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: About sprite animation
« Reply #4 on: August 04, 2012, 06:41:28 PM »

Hi,

 I`ve got some problem with sprites.

I create noloop anim sprite in scene_init.script.
Code: [Select]
global indicator = Scene.GetNode("indicator");
global indicator_sp = indicator.GetSpriteObject();
indicator_sp.Pause();

.. then in indicator.script

Code: [Select]
on "LeftClick" {indicator_sp.Play();}
After animation, indicator sprite change color from green to red.
Then actor goes to another scene and back, indicator is green again (!?).
How to fix this?

« Last Edit: August 04, 2012, 06:43:20 PM by Krosad »
Logged

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: About sprite animation
« Reply #5 on: August 06, 2012, 09:07:22 AM »

I still trying to solve this problem
i add global variable ind_act = 1 if sprite was animated.

in scene_init.script

Code: [Select]
global indicator = Scene.GetNode("indicator ");
global ind_act;
global indicator _sp = indicator .GetSpriteObject();
if(ind_act == 1)
{
indicator _sp.CurrentFrame = 6;      // 6 - last frame
indicator _sp.Pause();
}
else indicator _sp.Pause();

i thought it must work, but WME give fatal error.
« Last Edit: August 06, 2012, 09:29:45 AM by Krosad »
Logged

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re: About sprite animation
« Reply #6 on: August 06, 2012, 09:27:45 AM »

Hi,

first of all, when talking about errors WME throws, please also quote the error here. :-)

global indicator _sp = indicator .GetSpriteObject();
if(ind_act == 1)
{
indicator _sp.CurrentFrame = 6;      // 6 - last frame
indicator _sp.Pause();
}
else klawa_sp.Pause();

From what I can see immediately: you have a blank in your variable name between "indicator" and "_sp", that shouldn't be there. This will surely throw a fatal compile error.
Logged
Mooh!

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: About sprite animation
« Reply #7 on: August 06, 2012, 09:37:07 AM »

i did a blank, when i wrote this post, in scripts no blanks.


about errors WME throws. WME just don`t respond on Esc and i had to used ctrl+alt+del.

Code: [Select]
-----------------------------------------------------------------
---------- wme 1.9.001 crash report: 06-08-2012, 14:41 ----------
-----------------------------------------------------------------
wme.exe caused a EXCEPTION_ACCESS_VIOLATION in module wme.exe at 001B:00000000
EAX=00000000  EBX=04E418A0  ECX=04E3E808  EDX=04E58C40  ESI=00000000
EDI=0000000C  EBP=04E4CDB0  ESP=0012FD60  EIP=00000000  FLG=00010202
CS=001B   DS=0023  SS=0023  ES=0023   FS=003B  GS=0000
Stack trace:
001B:00000000 (0x04E4CDB0 0x0C5F471E 0x0000000C 0x00000017) wme.exe
001B:00440162 (0x656D6172 0x090C0C00 0x00030011 0x0208013B) wme.exe
001B:46746E65 (0x00000000 0x00000000 0x00000000 0x00000000) <UNKNOWN>
« Last Edit: August 06, 2012, 12:43:27 PM by Krosad »
Logged

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: About sprite animation
« Reply #8 on: August 06, 2012, 10:03:50 AM »

I think I found what It was.
Sprite must be set on next-to-last frame.
Logged
 

Page created in 0.043 seconds with 21 queries.