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: sprite problem  (Read 3791 times)

0 Members and 1 Guest are viewing this topic.

BattleCry

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
sprite problem
« on: October 29, 2009, 06:30:28 PM »

Hi

I have a problem with the sprites that I use on my objects.

It's that they replay the last sprite before it changes to the next sprite with SetSprite().
This also happens when I call on it using on "variable" even if it isn't supposed to do anything at all with the sprite.

How do I stop this?

Thanks for the help ;)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: sprite problem
« Reply #1 on: October 30, 2009, 08:40:13 AM »

I'm not sure what you mean. Can you post your script with a commentary?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

BattleCry

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: sprite problem
« Reply #2 on: October 30, 2009, 10:57:10 AM »

Sure, but I didn't do it before because I don't think it will help.
I know that it might be a Little bit hard to understand what the problem is but I don't know a better way to describe it..

Anyway this is a partion of the code I use and the most weird one when it comes to this problem. The thing is that if I call on "Time-Gun" and dead is not 1, it still replays the previous sprite.

And as I said before it does this whenever I change a sprite.

Code: [Select]
#include "scripts\base.inc"
var tic;
on "Time-Gun"
{
if(this.Dead == 1 && this.Time == 0)
{
this.SetSprite(this.Res);
this.Dead = 0;
}
else if(this.Time == 0)
{
this.Time = 1;
tic = 5;
while(true)
{
Sleep(1000);
tic = tic - 1;
if(tic == 0) break;
}
this.Time = 0;
}
else tic = 5;

}
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: sprite problem
« Reply #3 on: October 30, 2009, 06:33:51 PM »

I still don't get what the problem is, sorry. You say...

Quote
The thing is that if I call on "Time-Gun" and dead is not 1, it still replays the previous sprite.

That's normal, isn't it? You're calling the SetSprite method only id Dead is 1. So until you call SetSprite, the original sprite is used.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

BattleCry

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: sprite problem
« Reply #4 on: October 31, 2009, 01:52:43 PM »

Quote
You're calling the SetSprite method only id Dead is 1. So until you call SetSprite, the original sprite is used.
That is correct, but I use sprites that don't normally loop, but when I call on them as with the example of on "Time-Gun" it restarts the sprite it has even if it shouldn't. This is especially annoying when it is supposed to change sprite as it replays the sprite that is sett and then changes sprite.

I know a can fix it in making more endsprites for every animation but I don't got that time.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: sprite problem
« Reply #5 on: October 31, 2009, 02:58:39 PM »

Restart what sprite? The one you're setting? That's indeed intentional.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

BattleCry

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: sprite problem
« Reply #6 on: November 01, 2009, 01:09:36 PM »

I still think you're missing the problem, so I'll try to describe it as clearly as I can.

An entity has Sprite "A".

we want it to use an animation contained in sprite "b", so we set it's sprite to "b"... sprite b plays, so far all is well. (in our case the entity is "destroyed", and leaves a small wreck).

Now we want to "restore" the object, using a reversed destruction animation, contained here in sprite "c". Here we get problems, namely that when we set the sprite to C, the entity first plays sprite B again, and then plays sprite c - which as you can imagine, doesn't look all that great.

Is there any way we can circumvent this, or is it just hardcoded into WME that sprites are to behave this way - and in that case, how do you recommend we'd solve it?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: sprite problem
« Reply #7 on: November 01, 2009, 01:35:55 PM »

Um, can you make a small demo reproducing the behavior you described? Because I just tried it and can't confirm that. The first thing SetSprite does is that it destroys the current sprite, so I don't see how it could be replayed again.
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.033 seconds with 20 queries.