/ Published in: ActionScript 3
Produces a 'quake' effect on an instance of a MC. (It's The Rivera Era)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//ITS THE RIVERA ERA //THE FIRST URBAN PUERTO RICAN DEVELOPER //REPLACE 'instance_name_here' WITH YOUR //MC OBJECT INSTANCE NAME import flash.events.Event; stage.addEventListener(Event.ENTER_FRAME, mMotion); function mMotion(evt:Event):void { instance_name_here.x = stage.stageWidth / 2; instance_name_here.y = stage.stageHeight / 2; instance_name_here.x += Math.floor(Math.random() * 100); instance_name_here.y -= Math.ceil(Math.random() * 100); if (instance_name_here.x > stage.stageWidth) { instance_name_here.x = stage.stageWidth / 2; if (instance_name_here.y > stage.stageHeight) { instance_name_here.y = stage.stageHeight / 2; } } }