Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --For usage, check out the encounter Lua's EncounterStarting() and Update() functions.
- -- First, we can create the torso, legs and head.
- sanslegs = CreateSprite("spr_sansb_legs_0")
- sanstorso = CreateSprite("spr_sansb_torso_0")
- sanshead = CreateSprite("spr_sans_bface_0")
- --We parent the torso to the legs, so when you move the legs, the torso moves too.
- --We do the same for attaching the head to the torso.
- sanstorso.SetParent(sanslegs)
- sanshead.SetParent(sanstorso)
- --Now we adjust the height for the individual parts so they look more like a skeleton and less like a pile of bones.
- sanslegs.y = 235
- sanstorso.x = -3 --The torso's height is relative to the legs they're parented to.
- sanshead.y = 15
- --We set the torso's pivot point to halfway horizontally, and on the bottom vertically,
- --so we can rotate it around the bottom instead of the center.
- sanstorso.SetPivot(0.5, 0)
- --We set the torso's anchor point to the top center. Because the legs are pivoted on the bottom (so rescaling them only makes them move up),
- --we want the torso to move along upwards with them.
- sanstorso.SetAnchor(0.5, 1)
- sanslegs.SetPivot(0.5, 0)
- sanshead.SetPivot(0.5, 0)
- sanslegs.Scale(2, 2)
- sanshead.Scale(2, 2)
- sanstorso.Scale(2, 2)
- sanshead.SetAnimation({GetGlobal("SansFace")}, 1/3)
- -- {"spr_sans_bface_0"}, "spr_sansb_blueeye_0", "spr_sansb_blueeye_1", "spr_sansb_face_0", "spr_sansb_face_1", "spr_sansb_face_2", "spr_sansb_face_3", "spr_sansb_face_4", "spr_sansb_face_5", "spr_sansb_face_6", "spr_sansb_face_7", "spr_sansb_face_8", "spr_sansb_face_9"
- sanstorso.SetAnimation({"spr_sansb_torso_0"}, 1)
- --"spr_sansb_torso_2" "spr_sansb_torso_1"
- function Animate()
- if GetGlobal("dodge") ~= nil then
- if GetGlobal("dodge") then
- sanslegs.x = sanslegs.x + (200 - sanslegs.x) / 10
- if sanslegs.x < 200.1 then
- SetGlobal("dodge", false)
- end
- elseif sanslegs.x ~= 320 and not GetGlobal("dodge") then
- sanslegs.x = sanslegs.x + (320 - sanslegs.x) / 10
- if sanslegs.x > 319.9 then
- SetGlobal("dodge", false)
- sanslegs.x = 320
- end
- end
- end
- sanstorso.MoveTo(-2 + math.sin(Time.time * 4), math.sin(Time.time * 8))
- sanshead.MoveTo(0, 15 + 0.4 * math.sin(Time.time * 1.5))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement