MODULE: Tween 1.5.1

Started by edmundito, Sun 14/06/2009 04:42:24

Previous topic - Next topic

David Ostman

I tried that, but changing repeatedly_execute_always to repeatedly_execute in tween.asc didn't make any difference. The little ships in the background still animate when the game is paused. Been trying to figure out exactly what is going on here, but so far I'm drawing a blank.

edmundito

It's been a couple of years, but it's finally time for Tween 1.5! (informally titled Game Developers Conference 2012 Edition!)  8)

The biggest feature is that New-style AudioChannel from 3.2 is finally supported. I've also added some really cool new Tweens for positioning objects by constant speed instead of time. There was a lot of cleanup and improvements that were done to the code as well, making it easier to maintain for future versions (and this is why it went from 1.2 to 1.5...).

This is an RC1 (Release Candidate 1) because I haven't properly tested the thing yet. If you use it and find any issues, please reply to this thread and let me know and I'll start making some fixes!
The Tween Module now supports AGS 3.6.0!

Ghost

Sweet- I think I've use your module in almost every game. I'll give this a spin!


Snarky

Excellent!

I get an error on line 197 that token "gui" is undefined.

I was trying to test the repeat modes, because I seem to remember that it doesn't support a way to have something tween back and forth between two values indefinitely (so you could have a ball bounce up and down, for example), even though that's exactly what I would expect the ReverseRepeat mode to do. Anyway, that would be my feature request.

Calin Leafshade

Quote from: Snarky on Tue 06/03/2012 12:08:49
I get an error on line 197 that token "gui" is undefined.

This is almost always because you have no GUIs in your game.

Grim

That's wonderful! As a devoted Tween user I feel I really want to replace the old one I've been using in my game with this new 1.5 version and take it for a spin, I'm just a little worried it might mess things up with the old version already being used in almost every room in the game. Will old commands still work like they do or will I have to go back and rewrite everything?

But I've dreamt of using Tween for sound manipulation for so long.... This, truly, is the greatest module ever made for AGS! ;)

edmundito

Thanks for the testing so far guys!

@Snarky:
Can you confirm what CalinLeafshade said? And also can you paste some of the tween code you were trying to write tosee why your reverse repeat mode doesn't work?

@Grim:
What is the old version? Tween 1.5 remains mostly backwards compatible, you just have to tweak a few variables at the top of the headter script file to turn on old features. In any case, look at the previous version of tween that you are using and if all else fails you can replace it with the old version from http://code.google.com/p/ags-tween/downloads/list. If you need any help feel free to send me a forum message.
The Tween Module now supports AGS 3.6.0!

edmundito

"I get an error on line 197 that token "gui" is undefined."

- Calin is correct. Looks like you can't run the Tween module at the moment if you don't have any GUIs defined.

Does anyone know if there is a way to solve this? I tried doing something sneaky such as:

Code: ags

#ifdef gui
// Bunch of gui tweening code
#endif


But looks like that doesn't really do what I expect. Does anyone have a better solution?
The Tween Module now supports AGS 3.6.0!

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snarky

Sorry for the delayed response. I didn't have access to my PC for almost a week, and it's a pain to run it on my Mac.

Yeah, I just started writing from a blank game, so there weren't any GUIs. Bad form of AGS to not even declare it as a null variable if there aren't any, and I don't see how you can work around it. (No Dualnames, you can't just check GuiCount, because even if you make sure it doesn't run, the code still needs to be there, and it's either valid or invalid depending on whether the variable has been defined.) Maybe just document it and add a simple "// Object gui = null;" line to the top (and appropriate tests throughout) which users can uncomment if they need to use it in a no-GUI game.

As for the ReverseRepeat, I don't remember exactly what my problem was. I can see from the examples that it wasn't any of the basic functionality, like I thought. It might have been about knowing whether it's currently tweening forward or in reverse, or about resuming a paused tween. (Say you wanted all tweens to reverse whenever you pressed a button, for example.)

edmundito

Thanks for the info Snarky!

Yeah this gui seems like a semi-serious issue. Best thing to do is to as a work around is to create a gui and not just make it invisible and that should solve the problem.
The Tween Module now supports AGS 3.6.0!

Calin Leafshade

Is a reference to the gui array necessary?

Couldn't you just have an array of pointers to reference the guis that are passed to the module?

monkey0506

You can always maintain your own array internally:

Code: ags
// Script.asc
GUI *tween_guis[];

function game_start()
{
  if (!Game.GUICount) tween_guis = null;
  else tween_guis = new GUI[Game.GUICount];
  int i = 0;
  while (i < Game.GUICount)
  {
    tween_guis[i] = gui[i];
  }
}


And then just replace "gui" with "tween_guis" in the rest of the module. Presumably you're not actually using the array if there's no GUIs, but just simply referencing the array (which is completely undefined if there are no GUIs)...otherwise you'd also need to add a safety catch in the functions that use it.

Snarky

I'm pretty sure that code is going to fail to compile in a game with no GUIs because of the "tween_guis[i] = gui[i];" line. That's why I think the way AGS currently does it is broken.

Edited because those aren't italic tags...

Eric

This is the first module I've ever downloaded and used. The instructions were nice and clear, and it seems to function well. Thank you!

I have one question, though. I'm using this to fade a GUI in and out, and during the fade, the buttons are greyed out. Is this normal, preventing access to the functions of the GUI before it's fully opaque? Or have I screwed something up? It's a fine situation in every aspect except I'd prefer them not to be greyed out, aesthetically.

monkey0506

Snarky- You're right...ugh...I don't know what I was thinking why I thought that wasn't prey to the same problem as it's a compile-time error not run-time. :-\

I would actually say that AGS not defining the array is a bug. The preferred method should be for the array pointer to exist, but it just be null (like a dynamic array). Otherwise, as there's no macro for this, there's no way of getting around this compile-time error short of referencing the GUIs directly by their name.

Snarky

monkey: Yes, that's what I meant. It's an AGS bug, and the appropriate thing would be to define gui as null (or a 0-length array) if there are no GUIs.

Eric, this is due to a setting in your AGS game project. Go to the general game settings and look for something like "grey out GUIs when disabled" and set it to false.

Eric

Quote from: Snarky on Thu 15/03/2012 19:34:15Eric, this is due to a setting in your AGS game project. Go to the general game settings and look for something like "grey out GUIs when disabled" and set it to false.

Thanks! I knew the fault lay with me somewhere, and not the module!

edmundito

Cool, I'm glad you guys are talking about ideas. There's some interested solutions here to the GUI problem.

What I did in 1.5 is minimize the number of references in the module internals. If you're nerdy enough, you can check the diff:
http://code.google.com/p/ags-tween/source/diff?spec=svn35&r=35&format=side&path=/trunk/Tween/Tween.ash
(Scroll all the way to the bottom)

The only one I had left is GUIControl because this is a newer structure that did not have an internal array created for it AFAIK. However I guess I could revert back the gui to use a reference GUI* pointer as well, since there's only 3 or so GUI Tweens to maintain anyway.
The Tween Module now supports AGS 3.6.0!

SMF spam blocked by CleanTalk