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: Sprite Goto And Play from specific frame on  (Read 3065 times)

0 Members and 1 Guest are viewing this topic.

manarius

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 27
  • node it. node it all together my brethren :)
    • View Profile
    • Thats one of our Games :-)
Sprite Goto And Play from specific frame on
« on: March 07, 2008, 04:31:12 AM »

i used the possibillities of your engine to make my reverseable animation.
it consists of two entities (one opening one closing)
and a window (the actual menu)

the only thing i have a problem with is, that i didnt find any kind of gotoAndPlay function.

to be precise:
i want to tell a Sprite to Play from Frame x on. that way you could, for example, stop and reverse a menuscreen fadein
that would allow me to leave the control to the player.
right now i am working around this problem by disabling the button witch opens and closes my menuscreen,
but does the player really have to wait till the menu is opened, before he can close it?


did i completely overlook something=?  ::slug
is it anyhow possible to adress frames in sprites?


btw:
this engine is GREAT!!!
coming from Flash it took me nearly no time to get familiar with the engine and the workflow is really good.
thats programming fun :-)

greetings from vienna,
manarius
Logged

manarius

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 27
  • node it. node it all together my brethren :)
    • View Profile
    • Thats one of our Games :-)
Re: Sprite Goto And Play from specific frame on
« Reply #1 on: March 07, 2008, 04:44:07 AM »

i think i probably could fix it with insert/delete frame.
this way i could just add pngs at runtime.
would this be intense to render?
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: Sprite Goto And Play from specific frame on
« Reply #2 on: March 07, 2008, 08:28:33 AM »

Grützina manarius,

yes, there are several options how to address individual frames in a sprite.

1, you can query the sprite object:

Code: [Select]

var a = Scene.GetEntity("some of your sprites");
var b = a.GetSpriteObject();

b.Reset(); // this resets the position to 0;
b.Play(); // this starts playing the animation

b.CurrentFrame = 100; // this sets some position to specified frame (101) - it's 0 based.

while (b.CurrentFrame < 200) Sleep(1);  // we wait until some frame occurs and then do something

while (!b.Finished) Sleep(1); // we wait until the whole animation finish

Another way of dealing with this is attaching events to the individual frames and then checking on "your event" handler. Or sprite has low level event on "FrameChanged" which gets called
whenever sprite moves to the next frame. You'd have to attach script to sprite object (for example in the sprite editor) to intercept this low level event though.

And of course you can check my online book (see the community section of this forum).

Hope this helps.

PS. I do reverse sprites as a separate sprite files in the editor using a simple trick. In the open dialogue I set the windows open dialogue to list and reverse sort it, then select all files and add it. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

manarius

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 27
  • node it. node it all together my brethren :)
    • View Profile
    • Thats one of our Games :-)
Re: Sprite Goto And Play from specific frame on
« Reply #3 on: March 07, 2008, 02:07:16 PM »

thanks a lot,
i think now i will be able to solve the prob :-)

the reversing of images is mentioned in the thread i originally planned to post this thread to :-)
that's a nice idea, not sure if i would have thought of it myself.

I'll just play a bit with the codesnippets you gave me,
have fun you all,

greetings,
manarius

Logged
 

Page created in 0.042 seconds with 20 queries.