property pSpring -- spring factor property pFriction -- friction factor property pVy -- Y velocity property pOrigLoc -- the original location of the sprite property pOffsetLocV -- the offset Y point property pDoSpring -- -- Drag this behavior onto a sprite to apply a vertical spring effect to it. -- Ken Loge - http://diginoodles.com -- on beginSprite me pVy = 0 pOrigLoc = sprite(me.spriteNum).loc end on getPropertyDescriptionList me list = [:] addProp list, #pOffsetLocV, [#comment: "Offset Y Location:", #format: #integer, #default: 50, #range: [#min: -100, #max: 100]] addProp list, #pSpring, [#comment: "Spring Strength:", #format: #float, #default: .1, #range: [#min: .1, #max: 1.0]] addProp list, #pFriction, [#comment: "Friction:", #format: #float, #default: .9, #range: [#min: 0, #max: 2.0]] return list end on exitFrame me if pDoSpring = TRUE then ay = (pOrigLoc.locV - sprite(me.spriteNum).locV) * pSpring pVy = pVy + ay pVy = pVy * pFriction sprite(me.spriteNum).locV = sprite(me.spriteNum).locV + pVy end if end on mouseUp me pDoSpring = TRUE sprite(me.spriteNum).locV = pOffsetLocV end