Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author Miguel Panos
»  Title: Tarta
»  Description: It is a circle graph or pie chart that takes the data entered by user
»  More by Miguel Panos


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4839 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  AuthorDeft Creative Ltd
»  Link: Home Page
»  Description: Portfolio site for .DeftCreative Ltd. A UK based web design studio specialising in flash websites, games and interactive CDROMs. With an emphasis on making things different.


Random Links | Add your own Flash Related Links
Flash Tutorials 1484 Tutorials 7 New Tutorials Added!
What's New | Top100

» Making Automatic Training Screen Capture Easily
» Create Undersea Life Animation
» Making Deinterlace Video with a low bitrate Easily
» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Games

Categories Create a dynamic shadow effect
Author: Corky§urprise | Website: http://www.corkysurprise.com |

 
Page 3
«prev 1 2 3

' 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

«prev 1 2 3

» Level Basic

Added: : 2006-03-01
Rating: 5.83 Votes: 6
Hits: 1917
» Author
Yeah..umm..i'll get back to you on that...
» Download
Download the files used in this tutorial.
Download (0 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments