Object's size

  • #1, by dramaminiSaturday, 25. October 2014, 21:02 11 years ago
    A quick question:
    Is it possible, using Lua, to scale an object's size?
    (Not whole screen)

    Newbie

    44 Posts


  • #2, by afrlmeSaturday, 25. October 2014, 21:25 11 years ago
    Yes. But I'm not sure that the object polygon scales. Only the animation/image.
    -- animation (has to be playing on screen or preloaded prior to executing this code)
    ActiveAnimations["animation_name"].AnimationSize = 200 -- set animation_name to 200% scale (instant)
    ActiveAnimations["animation_name"]:to(3000, {AnimationSize = 200}, easeQuintOut) -- scale animation_name to 200% over 3 seconds.
    
    -- object image (static)
    game.GameCurrentScene.SceneObjects["object_name"].Scale = 200 -- scale object_name to 200% instantly
    game.GameCurrentScene.SceneObjects["object_name"]:to(3000, {AnimationSize = 200}, easeQuintOut) -- scale object_name to 200% over 3 seconds.
    

    ...unverified code. I'm still trying to familiarize myself with the new shorthand code & functions.
    :to() -- is a new workflow function for transitioning smoothly/gradually between current value & target value over a specified amount of time, with easing, loop & reverse options.
    

    Imperator

    7285 Posts