Search tutorials
'
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 - CorkySurprise@aol.com // http://www.corkysurprise.com // 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) aol.com| » Level Basic |
|
Added: 2006-03-01 Rating: 6 Votes: 6 |
| » Author |
| Yeah..umm..i'll get back to you on that... |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


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