
.gif)
.
.
.
مرحبتين أحييكم اليوم بدرس جديد للسويش...وأعتقد محد قد سواه :33: يارب يعجبكم.
.
.
.
مثال على الدرس...طبعاً هذا مجهود مني.. وطبعاً مو أختراعي بس فكيت ملف مفتوح :icon28:
.
.
.
WIDTH=500 HEIGHT=300
.
.
.
الشــــــــــــرح
.
.
.
1-ندرج سبرايت ثم ندرج سبرايت أخر داخل الأول ونسمية ...Swirl ....الأن نضيف هذا الأسكربت للسبرايت الأول.
.
.
.
onLoad() {
//
// We are going to make multiple copies of
// the Swirl sprite to form the funnel of
// the tornado. So we don't want to see the
// original Swirl sprite itself .. only the
// duplicate copies.
Swirl._visible=false;
//
// h will determine the height of the funnel.
// w will determin how far it can move
h = 250;
w = 400;
//
// stop is how far apart the swirls that make
// up the funnel are spaced vertically
step = 10;
//
// move controls the ammount of random movement
move = 10;
//
// narrow controls the narrowness of the funnel
// it has to be <1 to mae the funnnel become
// narrow at the bottom. The smaller the value
// the narrower the funnel
narrow = 0.9;
//
// lastx is used for moving the tornado and
// refers to the last x position of the topmost
// swirl
lastx = 0;
//
// Now we make the duplicates. To start with
// they will be stacked directly on top of each
// other with each one slightly smaller in xscale
// to form a narrowing funnel
xscale = 1;
for (y = 0; y < h; y += step) {
// make a duplicate of the (hidden) swirl
// at the given y value. Each sprite needs
// a unique name and depth, so we use the
// y value to make unique values. s will
// refer to the swirl duplicate we just made
s = Swirl.duplicateSprite("Swirl"+y,y+1);
//
// set the xscale of the swirl
s._xscale = xscale*100;
//
// set the position of the swirl
s._x = lastx;
s._y = y;
//
// xscale is going to be smaller each time
// to make the funnel narrow toward the bottom
xscale *= narrow;
}
}
onEnterFrame() {
//
// move the top of the tornado a bit. This
// formula will try to keep the tornado centred
// and it wont go outside the bounds we set
lastx += (Math.random()-0.5-lastx/w)*move;
//
// as we loop thru the swirls, x will have the
// x value of the swirl above the one we are
// moving. We use this to keep the swirls
// together so the funnel does not break apart
x = lastx;
for (y = 0; y < h; y += step) {
//
// s is the swirl we are moving
s = this;
//
// add some random movement to the
// position
x += (Math.random()-0.5-x/w)*move;
//
// we average with current value to keep
// funnel together
x = (x+s._x)/2;
//
// now move the swirl
s._x = x;
}
}
_______________
2- الأن نرسم مربع داخل السبرايت الثاني ونغيــــــــــــــر التعبأة كمــــــا هو موضـــــــــــح.
.
.
.
.
.
.
3-نضيف أي صورة نريدها تشبه الأعصار ونضعها تحت المربع ونخليها بعرض مساحة العمل وطولها زي ماهو موضح بالصوره .
.
.
.
.
.
.
ونضيف لها هذا الأكشن.
.
.
.
onLoad() {
//
// set the speed of the swirl 'rotation'
speed = 10;
}
onEnterFrame() {
//
// pseudeo rottion .. we just move the image
// of the tornado swirl from left to right
// and reset back to left when finished to
// make it continuous (note that the image
// is tiled to have two images side by side
// and was chosen so that it tiles smoothly
_x += speed;
if (_x >= 100) {
_x = -100;
}
}
.
.
.
____________________
3- بقي رسم دائــــــــــــره بيضاوية الشكـــــــــــل ونضعها تحت الصوره يعني يكون ترتيبها الثالث وأن تكون بطول وعرض المربع والصورة كما موضح في الصورة أعلاه..
والآن جرب عملك..
درس رووووعه
بس سبحان الله
الله ماعطاني حب السويش
جربته قبل سنه ولاعرفت له
احسه صعبببببببببببب
لكن نتائجه حلوه ,,