K
Kamon145
Guest
Hello everyone, I'm trying to come up with a code that will slowly shrink a sprite to about 75%, and than have it grow back and repeat, like its sort of pulsing.
The code i came up with will shrink the sprite but it just gets stuck after that and dosen't grow, also its kind of an ugly code... I'm sure I'm doing more than necessary to achieve this effect, but I am still fairly new to coding and could use a professionals opinion..
This is my current code in the step event, note that the variable "size" is set to 1 in the create event:
I would also like to move this into a script once I get it working, so I can use it on other objects if necessary, oh and if anyone is curious, the object i am working on is the pause button and i want my pause sprite to pulse. Any help or suggestions would be greatly appreciated, thanks guys! =]
The code i came up with will shrink the sprite but it just gets stuck after that and dosen't grow, also its kind of an ugly code... I'm sure I'm doing more than necessary to achieve this effect, but I am still fairly new to coding and could use a professionals opinion..
This is my current code in the step event, note that the variable "size" is set to 1 in the create event:
Code:
if paused
{
var shrink = true
if size > .75 and shrink = true
{
size -=.01
if size <=.75
shrink = false
}
else
if size < 1 and shrink = false
{
size +=.01
if size >=1
shrink = true
}
}
image_xscale = size;
image_yscale = size;