Add this to your ball place the script in the script. -- Squish effect: stretch toward the touch by projecting deformation onto x/y axes.
-- No rotation is used, which means no spinning can ever occur.
local BASE_W = 2
local BASE_H = 2
local STRETCH = 2.4 -- how much to elongate along the touch axis
local SPRING_K = 150 -- stiffness (higher = snappier)
local DAMPING = 8 -- damping (lower = more bouncy/wobbly)
local cW, cH -- current width/height spring position
local vW, vH -- spring velocities
function onCreate()
BASE_W = my.layout.widthScale
BASE_H = my.layout.heightScale
cW, cH = BASE_W, BASE_H
vW, vH = 0, 0
my.layout.rotation = 0
end
function onUpdate(dt)
-- Find a touch currently on this ball
local touched = false
local touchAngle = 0
for _, touch in ipairs(castle.getTouches()) do
for _, actor in ipairs(castle.getActorsAtTouch(touch.id)) do
if actor == my then
local dx = touch.x - my.layout.x
local dy = touch.y -
Ive got some ideas:
-animate with your oc (doing activiteis or something)
-animate an old or New popular meme
-animate something you like or love (like an idol of yours)
-- Squish effect: stretch toward the touch by projecting deformation onto x/y axes.
-- No rotation is used, which means no spinning can ever occur.
local BASE_W = 2
local BASE_H = 2
local STRETCH = 2.4 -- how much to elongate along the touch axis
local SPRING_K = 150 -- stiffness (higher = snappier)
local DAMPING = 8 -- damping (lower = more bouncy/wobbly)
local cW, cH -- current width/height spring position
local vW, vH -- spring velocities
function onCreate()
BASE_W = my.layout.widthScale
BASE_H = my.layout.heightScale
cW, cH = BASE_W, BASE_H
vW, vH = 0, 0
my.layout.rotation = 0
end
function onUpdate(dt)
-- Find a touch currently on this ball
local touched = false
local touchAngle = 0
for _, touch in ipairs(castle.getTouches()) do
for _, actor in ipairs(castle.getActorsAtTouch(touch.id)) do
if actor == my then
local dx = touch.x - my.layout.x
local dy = touch.y - my.layout.y
touchAngle = math.atan2(dy, dx) --