Following on from the discussion in this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37075) I've created a module that you can use to scale all the sprites for a character, or to apply various other "distortions" to the sprites instead.
Needs: AGS 3.1.2 (but might work with earlier ones from 3.0 on, try it and see!)
Documentation (http://ssh.me.uk/moddoc/DistortChar)
Download (http://ssh.me.uk/modules/DistortChar.zip)
Thanks module man!!! ;)
Interesting approach to store and re-use the DynamicSprites once rendered. I employ a lot of similar effects in my scripts but always generate them on a loop by loop basis, which of course impairs the framerate if overused (though often necessary for dynamic shadows and lightmap tinting). Have you run any tests on how the module affects memory overhead and savegame size?
Nope!
It's a shame that you can't generate dynamic arrays of Dynamic Sprite pointers, as that's what I'd prefer (or what might be best was if all sprite numbers inside AGS were actually pointers so you could set the pointer to the dynamic sprite so that it would still have a global reference and not need to worry about it getting garbage-collected.)
Quote from: SSH on Fri 06/03/2009 12:41:40It's a shame that you can't generate dynamic arrays of Dynamic Sprite pointers, as that's what I'd prefer
Yes you can. In fact if it makes you more comfortable you can even write your own alloc/free functions:
DynamicSprite *Sprites[];
int SpriteCount = 0;
void spr_free() {
SpriteCount = 0;
Sprites = null;
}
void spr_alloc(int count) {
if ((count <= 0) || (count > 1000000)) {
spr_free();
return;
}
SpriteCount = count;
Sprites = new DynamicSprite[count];
}
Just tested that and it runs perfectly.
Oh! The manual says that you can't make dynamic arrays of managed types...
That's rather silly considering it's only the basic data and the managed types you can make dynamic arrays of...hmmm...
Contents>Scripting>Dynamic ArraysQuoteAlso, at present you can create arrays of basic types (int, char, etc) and of built-in types (String, Character, etc) but not of custom structs.
Where does it say you can't use managed types?
Hmmm, my brain must not have been working when I read it. :=
Does that mean you can create objects dynamicly???
No, but you can create pointers to objects dynamically.
Really don't know what can I do with a pointer, either what pointer means...
I've heard that word many times when I received programming lessons, but never understood it, so what's it?
Well Joe, this (http://www.americangirlscouts.org/agswiki/AGS_Pointers_for_Dummies) is the best way I have of explaining that.
And SSH, I just wanted to let you know how stoked I am to hear that I'm not the only one who goes into cerebral arrest writing these modules sometimes...