On Jan 17, 2006, at 7:55 PM, Michael Nadel wrote:
Thanks everyone for your great answers!


let me add one thing regarding floats vs. integers;

if you're using a parentscript- or behaviourinstance to animate your sprite, it's usually a good idea to modify script-properties rather than sprite-properties.

a sprites' dimensions are always integers.
if you modify those with floats, the calulation will be rounded-off to integer again on each frame this can lead to unexpected results since there's no such thing as a half pixel..

the way the example works, you can animate with for instance 0.01 pixels per frame.

even better would be to animate the sprite with pixels per second instead pixels per frame...
but that's another story


so for example:

-- parent script/behaviour

property spriteWidth, spriteHeight
property scaleFactor

on beginSprite me
        spriteWidth = mySprite.width
        spriteHeight = mySprite.height
        scaleFactor = 1.1000
end

on exitFrame me
        spriteWidth = spriteWidth * scaleFactor
        spriteHeight = spriteHeight * scaleFactor
if spriteWidth < mySprite.member.width and spriteHeight < mySprite.member.height then
                mySprite.width = spriteWidth
                mySprite.height = spriteHeight
        end if
end
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to