property pSpring -- spring factor property pFriction -- friction factor property pVx -- X velocity property pOrigLoc -- the original location of the sprite property pOffsetLocH -- the offset X point property pDoSpring -- -- Drag this behavior onto a sprite to apply a horizontal spring effect to it. -- Ken Loge - http://diginoodles.com -- on beginSprite me pVx = 0 pOrigLoc = sprite(me.spriteNum).loc end on getPropertyDescriptionList me list = [:] addProp list, #pOffsetLocH, [#comment: "Offset X Location:", #format: #integer, #default: 100, #range: [#min: -300, #max: 300]] 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 ax = (pOrigLoc.locH - sprite(me.spriteNum).locH) * pSpring pVx = pVx + ax pVx = pVx * pFriction sprite(me.spriteNum).locH = sprite(me.spriteNum).locH + pVx end if end on mouseUp me pDoSpring = TRUE sprite(me.spriteNum).locH = pOffsetLocH end