Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Khris on Wed 05/12/2007 18:55:25

Title: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Khris on Wed 05/12/2007 18:55:25
Dynamic Sprite Rotation Module v0.1 by KhrisMUC

Tested with and coded for AGS3.0 RC1 - Can be used freely. No credit required.

DOWNLOAD (https://dl.dropbox.com/s/efscrzks0gqdv5y/DynSpriteRotation_v0.1.rar?dl=1)
(includes the following documentation and example room script)


- DynamicSprite* DynS.CreateFromExistingSprite(int slot, optional bool preserveAlphaChannel)

Replacement for the built-in function, used to create a new dynamic sprite.
Returns the created dynamic sprite just like the standard function.
*Must* be used to create the sprite in order to rotate it using the new function.
To use e.g. DynamicSprite.CreateFromBackground() instead of an available slot, call DynS.CreateFromExistingSprite() afterwards using the first sprite's graphic as slot parameter.
Note that in this case the first sprite has to be kept in memory! You have to rotate a second sprite!



- DynamicSprite* DynS.Rotate(DynamicSprite*dys, int offset)

Returns the rotated dynamic sprite. dys is the current sprite, offset the angle to rotate it by.
Note that you must set the original sprite!
Example:
 my_sprite=DynS.Rotate(my_sprite, 10);    // rotates my_sprite by 10 degrees


- int DynamicSprite.XO(), int DynamicSprite.YO()

When drawing the (rotated) sprite, add these to the coordinates to prevent the sprite from moving about.
Example:
 ds.DrawImage(100+my_sprite.XO(), 100+my_sprite.YO(), my_sprite.Graphic);


- int DynamicSprite.XC(), int DynamicSprite.YC()

Same as above but centers the (rotated) sprite at the given coordinates.

Note that XC, YC, XO, YO work for all dynamic sprites, not just rotated ones.
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Daniel Eakins on Tue 29/11/2011 23:08:58
The link is dead  :( Do you (or someone else) still have this module?
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Dualnames on Wed 30/11/2011 11:14:21
When all else fails, Dualnames is the best.

http://www.mediafire.com/?ad86unpfqw0j66k
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Daniel Eakins on Wed 30/11/2011 17:10:15
Thanks!
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: monkey0506 on Wed 30/11/2011 18:04:46
If you're using AGS 3.0 there's not really much reason that I'm aware of not to upgrade at least to 3.1.2 if not 3.2.1. The new-style audio does remove the ability to play raw MP3 files from the HDD, so that could be a reason to avoid 3.2.1 (if you really wanted to use that feature), but I'm not aware of any limitations between 3.0 and 3.1.2 that would remove functionality like that.
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Snarky on Thu 01/12/2011 11:09:43
Since the thread is from 2007, I assume we should take "3.0 only" to mean "3.0 and newer."

But AGS has built-in sprite rotation capabilities already, no? What's the benefit of using this plugin? If you could set the rotation as a float I could see the advantage (a 1-degree rotation is often too coarse, I find).
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Daniel Eakins on Thu 01/12/2011 12:08:08
I actually have several test games or abandoned projects that I keep around to do coding experiments on, and some are for AGS 3.0 and one is for AGS 3.2.1 (because of when I started them). There's no real reason I don't just use AGS 3.2.1 only; it's just that I have several experimental scripts and unfinished personal modules scattered among these projects and I haven't merged them all into a single (probably 3.2.1) project yet.

Anyway, I'm under the impression that this script makes multiple rotations less "lossy" on the sprite than rotating an already-rotated sprite the normal way, based on this thread: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33115.0
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: monkey0506 on Fri 02/12/2011 01:54:21
Huh, for some reason I thought I remembered Khris saying that it wasn't necessary as of 3.0.1, but I didn't see anything in the changelog that seemed relevant, unless I just totally overlooked it. Ignore me then if that's not the case.
Title: Re: MODULE: DynamicSprite Rotation v0.1 - AGS 3.0 only!
Post by: Khris on Fri 09/12/2011 00:44:46
To clarify, like Daniel said, this module stores the original sprite and thus rotating a rotated sprite doesn't accumulate messy pixels.
It still uses the built-in DynamicSprite.Rotate but keeps track of the current angle and always rotates the original sprite.

I've updated the download link, thanks Dualnames.