I have a section of my game which is like a point and click, for which I'm implementing items that are on the screen waiting for the player to click on them.
My problem is with the transform that goes with the items, which are buttons. I implemented a kind of "shaking" effect, which works well, but I've been trying to make it so that the item stops shaking and goes slightly bigger when the player hovers the mouse over it, but I can't seem to make it work.
Here's my test button:
Code: Select all
imagebutton:
idle "items/acguinv.png"
hover "items/acguinvh.png"
pos (500, 300)
action [If (len(inventory.items) < 4, true = [SetVariable("item", acgu5), SetField(acgu5, "act", False), Hide("picktt"), item_add], false = NullAction())]
hovered Show("picktt", item=acgu5, ittt=acgu5.tt, itxpos=500, itypos=300, itxmax=560, itymax=360, itxcen=530, itycen=330)
unhovered Hide("picktt")
at itshake(500, 300, 60, 60)
Code: Select all
transform itshake(xp, yp, xs, ys):
on show:
alpha 0
linear 0.2 alpha 1.0
block:
pos (xp, yp)
size (xs, ys)
linear 2.5 pos (xp, yp) size (xs, ys)
easeout 0.1 pos (xp-5, yp-5) size (xs+10, ys+10)
easein 0.05 pos (xp, yp) size (xs, ys)
repeat
I've been trying many things without success. As you can see, the hover image of my button is not the same as the idle one and that's because the last thing I tried was adding an "on replace" block in the transform, without success whatsoever: the button is still shaking when I hover the mouse over it. Can anyone help me? I want the button to stop shaking when the player hovers the mouse over it and start shaking again when the mouse isn't over it anymore.