First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Corky§urprise | Website:
' Copy and paste the following.

// This script is just for an idea, it isnt perfect and I'm aware of that! // Script "poorly" made by Corky§urprise - // // tree made by ChrisF // Shadow Concept by OSteel onClipEvent (load) { // When the tree movieclip loads onto the screen... (executed once) _root.attachMovie("shadow", "shadow", 5); // Attach the shadow movie clip, with a new name of shadow, and a depth of 5 (not really important) _root.shadow.swapDepths(this); // swaps the 'depth' of the shadow with this, sending the shadow behind the tree } onClipEvent (enterFrame) { // When the tree movieclip has loaded the screen... //(executed constantly, for example a frame rate of 12 would be executed 12 times a second) deltaX = _x-_parent.sun._x; // finds angle1 deltaY = _y-_parent.sun._y; // finds angle2 angleR = -Math.atan2(deltaX, deltaY); // Tricky math thing, converts the 2 angles into radians (angleR<<<) angle = Math.round(angleR*180/Math.PI); // Converts our radians into degrees. _root.shadow._x = _x; // places the shadow where this tree is on the x axis _root.shadow._y = _y; // places the shadow where this tree is on the y axis _root.shadow._rotation = angle+170; // Rotates the tree accordingly (Dont ask why it is 170, its a guess) if (_parent.sun._y>_y) { // if the sun is Under the tree _root.shadow._visible = false; // hide the shadow // In real life, if you managed to get on top of // the sun, you wouldnt see a shadow, right? } else { // If the sun ISNT under the tree... _root.shadow._visible = true; // Show the shadow! } }

The code is explained well enough, so i'll leave it as that. Test the movie (control + enter) and you should (hopefully) see a shadow around your character. It isnt perfect, but it's a start. That is basically it, in my next tutorial I will show you how to make something useful. Yes, something actually useful. Send all hate mail / questions / comments to corkysurprise (at)
» Level Basic

Added: 2006-03-01
Rating: 6 Votes: 6
(10 being the highest)
» Author
Yeah..umm..i'll get back to you on that...
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.