property pVert -- up and down movement property pHoriz -- side to side movement property pVal -- sine "angle" value property pOscPoint -- the point around which oscillation occurs property pAmplitude -- the range of movement property pSpeed -- speed of movement property pDoMove -- move the sprite, or not -- -- Drag this behavior onto a sprite to oscillate it back and forth, or up and down repeatedly. -- Ken Loge - http://diginoodles.com -- on beginSprite me pVal = 0 pOscPoint = sprite(me.spriteNum).loc pDoMove = TRUE -- move the sprite by default end on getPropertyDescriptionList me list = [:] addProp list, #pHoriz, [#comment: "Horizontal Movement:", #format: #boolean, #default: TRUE] addProp list, #pVert, [#comment: "Vertical Movement:", #format: #boolean, #default: FALSE] addProp list, #pAmplitude, [#comment: "Amplitude:", #format: #integer, #default: 50, #range: [#min: 0, #max: 300]] addProp list, #pSpeed, [#comment: "Speed:", #format: #float, #default: .1, #range: [#min: .1, #max: .5]] return list end on exitFrame me if pDoMove = TRUE then if pHoriz then sprite(me.spriteNum).locH = pOscPoint.locH + sin(pVal) * pAmplitude pVal = pVal + pSpeed else sprite(me.spriteNum).locV = pOscPoint.locV + sin(pVal) * pAmplitude pVal = pVal + pSpeed end if end if end on mouseEnter me pDoMove = FALSE pAngle = 0 end on mouseLeave me pDoMove = TRUE end