Hey, I'm Sonicbulletwolf1!
Explanation
I'm working on a UI system and this included a heart icon that beats every few seconds. I will provide resources below, but I noticed with bigger moment it would change where the position Is. Understanding that changing the size will, of course, change the location of the icon. This is where I have trouble. Though I want to first look at my code and see if its the most efficient / best way to go at it.
Side Note: The current script works with smaller movements.
Resources:
-- HeartUIHandler -- author Sonicbulletwolf -- since 5/6/2020 local phase1, phase2, phase3 = true,false,false local tweenService = game:GetService("TweenService") while wait(1) do if phase1 then phase1 = false phase2 = true elseif phase2 then script.Parent:TweenSize( UDim2.new(.0365, 0, .1065, 0), "Out", "Elastic", 1, false ) phase2 = false phase3 = true else script.Parent:TweenSize( UDim2.new(.035, 0, .105, 0), "In", "Elastic", 1, true ) phase3 = false phase1 = true end end
Video Resources
Smaller Movements [ Current Script] https://media.giphy.com/media/L3R8S83yoX1ewSqkhZ/giphy.gif
Macro Movements [ Slighty Changed Script] https://media.giphy.com/media/S9u8JVAgWT19CMVa8T/giphy.gif
Further Explanation
In this model, or test you can see that with micromovements it wouldn't seem to change, but it did. The task I'm having trouble with is understanding how to use TweenService Size and Position with different inputs given.
Expanding on this idea, when you take damage the heart handler will retrieve that amount and expand in size based on it. Meaning, I won't have a set number to fall back on. In short, it will differ based on the amount of damage the user takes.
I do understand that after about a second I could change the size and position back to the original form, which I didn't do in the current script.
My question is do you think I would have to worry that much about the changing of position? If so, in theory, what would be the best way to formulate the size and position?