Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Animate sprites in windows  (Read 3237 times)

0 Members and 1 Guest are viewing this topic.

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Animate sprites in windows
« on: March 27, 2012, 11:58:11 AM »

I have set up a static control in a window
The image for the static control is an animated sprite.
The animated sprite looping attribute is set to no
The animated sprite works fine once, so I have attempted to set it performing 5 loops, I have done this by using the methods Play() and Reset()
When I run the program I get cannot associate method with object for both Play() and Reset(). I have tried both methods , with a reference to both the control objects and a reference to the control objects image, neither can accept the method, any ideas

Code: WME Script
  1. if (questwin == null)
  2.   {
  3.  
  4.  questwin = Game.LoadWindow("interface\questlog\questlog.window");
  5.  
  6.  }
  7.    
  8. questwin.Visible = false;
  9.  
  10.  var showcrystal = statuswindow.GetControl("crystal"); //gets the static control crystal
  11.  var cryspic = showcrystal.GetImage();    // gets a reference to the static control sprite
  12.  //Game.Msg(cryspic); 
  13.  Debug();
  14.  var leftpage = questwin.GetControl("pageleft");
  15.  leftpage.SetImage("data\interface\questlog\qj1.png");
  16. rightpage = questwin.GetControl("pageright");
  17.  rightpage.SetImage("interface\questlog\q1start.png");
  18. // global log_but_stat = 1;
  19. showcrystal.Visible = true;
  20. for (var n =1;n < 4; n=n+1)
  21.  {
  22.    // sets image visible
  23.    cryspic.Play();   // plays the animation
  24.    
  25.    Sleep(1280);
  26.    cryspic.Reset();   // resets the animation
  27.    }
  28.  
  29.  showcrystal.Visible = false;
  30.   }
  31.  
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Animate sprites in windows
« Reply #1 on: March 27, 2012, 04:04:30 PM »

In Line 11, have you tried showcrystal.GetImageObject() ?

Have a look in the docs under 'Static' object

HTH

Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 301
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: Animate sprites in windows
« Reply #2 on: March 27, 2012, 04:06:40 PM »

Have you tried putting the images into a .sprite file and using that?
Logged

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Re: Animate sprites in windows
« Reply #3 on: March 28, 2012, 12:45:32 PM »

GetImageObject works thanks, in the interim I have coded round it, but it's useful to know for the future, the image s were alway stored in a sprite file.

Logged
 

Page created in 0.048 seconds with 20 queries.