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: Pause an animation  (Read 4852 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
Pause an animation
« on: February 05, 2012, 01:09:15 PM »

Hi!

I have a sprite with animation. How to pause or stop the animation ?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Pause an animation
« Reply #1 on: February 05, 2012, 02:51:59 PM »

Code: WME Script
  1.  
  2. var ent = Scene.GetNode("some node");
  3. var sprite = ent.GetSpriteObject();
  4.  
  5. sprite.Pause();
  6. sprite.Play();
  7. sprite.Reset();
  8.  
  9.  

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: Pause an animation
« Reply #2 on: February 05, 2012, 08:02:08 PM »

doesn't work
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Pause an animation
« Reply #3 on: February 05, 2012, 08:09:45 PM »

please post relevant scripts. It works so your code must be wrong. ;)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: Pause an animation
« Reply #4 on: February 06, 2012, 07:45:04 AM »

in scene_script

global light = Scene.GetNode("light");
global light_s = ent.GetSpriteObject();

light_s.Pause();
Logged

GreyDay

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 23
    • View Profile
Re: Pause an animation
« Reply #5 on: February 06, 2012, 10:08:02 AM »

You should put the code in the appropriate Scene_init script, and it should work.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Pause an animation
« Reply #6 on: February 06, 2012, 10:23:41 AM »

If this is the actual code, it's wrong. You probably meant:

global light = Scene.GetNode("light");
global light_s = light.GetSpriteObject();

Also it's probably unnecessary to use global variables for this.
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: Pause an animation
« Reply #7 on: February 06, 2012, 09:50:02 PM »

GreyDay

i have one scene.

Mnemonic

Still doesn't work.
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Pause an animation
« Reply #8 on: February 07, 2012, 12:01:45 AM »

if you ever want to have your problem solved, you should be more verbose. Your minimalistic communication approach just prevent us from helping you. We have no clue where you are writing your scripts. We don't know if they are even called. If you want to make sure your code is being called either use built in debugger or Game.Msg() function.

Unless you tell us more, the only thing, which is for sure is that the fault is not in the Pause() method.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Krosad

  • Anate Studio
  • Occasional poster
  • **
  • Karma: 2
  • Offline Offline
  • Gender: Male
  • Posts: 97
  • anatestudio.com
    • View Profile
    • Anate Studio Web site
Re: Pause an animation
« Reply #9 on: February 09, 2012, 01:17:28 PM »

Sorry, i made a mistake. In fact, everything worked. Thanks.
Logged
 

Page created in 0.136 seconds with 22 queries.