B
BenSunhoof
Guest
Does anybody know how one can make a sprite grow and shrink gradually? Imagine it like looking down on a bouncing object from the top. Any help would be appreciated!
///wave(from, to, duration, offset, timer)
// timer default = current_time
/// @description wave(from, to, duration, offset, timer)
/// @function wave
/// @param from
/// @param to
/// @param duration
/// @param offset
/// @param timer which timer to use, enter 0 for default current_time
// Returns a value that will wave back and forth between [from-to] over [duration] seconds
// Examples
// image_angle = wave(-45,45,1,0) -> rock back and forth 90 degrees in a second
// x = wave(-10,10,0.25,0) -> move left and right quickly
// Or here is a fun one! Make an object be all squishy!! ^u^
// image_xscale = wave(0.5, 2.0, 1.0, 0.0)
// image_yscale = wave(2.0, 0.5, 1.0, 0.0)
if argument4 = 0 argument4 = current_time;
a4 = (argument1 - argument0) * 0.5;
return argument0 + a4 + sin((((argument4 * 0.001) + argument2 * argument3) / argument2) * (pi*2)) * a4;
Thank you, this script is great. But is there a way remove this gradual scaling when the object "hits" the ground? You know what I mean? Again, think of it as bouncing.Add this to a script called wave and then call it in a step event as the examples show to change the image_xscale and image_yscale.
Code:///wave(from, to, duration, offset, timer) // timer default = current_time /// @description wave(from, to, duration, offset, timer) /// @function wave /// @param from /// @param to /// @param duration /// @param offset /// @param timer which timer to use, enter 0 for default current_time // Returns a value that will wave back and forth between [from-to] over [duration] seconds // Examples // image_angle = wave(-45,45,1,0) -> rock back and forth 90 degrees in a second // x = wave(-10,10,0.25,0) -> move left and right quickly // Or here is a fun one! Make an object be all squishy!! ^u^ // image_xscale = wave(0.5, 2.0, 1.0, 0.0) // image_yscale = wave(2.0, 0.5, 1.0, 0.0) if argument4 = 0 argument4 = current_time; a4 = (argument1 - argument0) * 0.5; return argument0 + a4 + sin((((argument4 * 0.001) + argument2 * argument3) / argument2) * (pi*2)) * a4;