karisik kodlar

--------------------------------------
cisimlere çarpa bilen fizik motorlu movieclip
--------------------------------------------------

bir movie clip yapın instance name'i  ball1  olsun.
bu fizik motorlu topa;


onClipEvent (load) {
 vx = Math.random()*20-10;
 vy = Math.random()*20-10;
}
onClipEvent (enterFrame) {
 for (i in _parent) {
  if (i.substring(0, 4) == "wall") {
   wall = _parent[i];
   ball = this;
   if (ball._x-ball._width/2>=wall._x-wall._width && ball._x+ball._width/2<=wall._x+wall._width) {
    x = ball._x-wall._x;
    y = ball._y-wall._y;
    a = wall._rotation*Math.PI/180;
    xw = Math.cos(a)*x+Math.sin(a)*y;
    yw = Math.cos(a)*y-Math.sin(a)*x;
    vxw = Math.cos(a)*vx+Math.sin(a)*vy;
    vyw = Math.cos(a)*vy-Math.sin(a)*vx;
    if (yw+ball._width/2>=0) { //  && yx-ball._width/2<=0+wall._width
     vyw *= -.8;
     yw = 0-ball._width/2;
     x = Math.cos(a)*xw-Math.sin(a)*yw;
     y = Math.cos(a)*yw+Math.sin(a)*xw;
     vx = Math.cos(a)*vxw-Math.sin(a)*vyw;
     vy = Math.cos(a)*vyw+Math.sin(a)*vxw;
     ball._x = wall._x+x;
     ball._y = wall._y+y;
    }
   }
  }
 }
 _x += vx;
 _y += vy;
 vx *= .999;
 vy += .1;
}


ekleyin sonra.
çarpabileceği cisimlere verilecek instance name  ler;

wall1
wall2
wall3
wall4
wall8

------------------------------------------
Animayonun kaç defa açıldığını gösteren yazı
-----------------------------------------

bir dinamik text oluşturun ve adını:  visits   koyun.
sonra 1.frame'e


// internetteki gibi cookies
function getCookies(){
 so = SharedObject.getLocal("menu");
}
function setCookies(){
 so.flush();
}

// girişler: visits
getCookies();
so.data.visits++;
visits = so.data.visits;
setCookies();

 

 

yazın.
bu kod çok kulanılan bir koddur.

 


-----------------------------------------
Fareden kaçan movie clip
--------------------------------------

movie clipe ekleyin.

 

onClipEvent(load){
 vx = 0;
 vy = 0;

 f = .93;
 m = 100;
}

onClipEvent(enterFrame){
 if(this.hitTest(_parent._xmouse, _parent._ymouse, true)){
  _alpha = 80;
  if(Key.isDown(1)){
   trace("hit");
  }
 }
 else{
  _alpha = 100;
 }

 dx = _x - _parent._xmouse;
 dy = _y - _parent._ymouse;
 d = Math.sqrt(dx*dx + dy*dy);

 if(d < m){
  vx += (dx)/4;
  vy += (dy)/4;
 }

 vx *= f;
 vy *= f;

 _x += vx;
 _y += vy;
 
 if(_x > 570){ _x -= 550; }
 if(_x < -20){ _x += 550; }
 if(_y > 420){ _y -= 400; }
 if(_y < -20){ _y += 400; }

}

 


----------------------------------------------
bir movie clip değmeden yaklaşan movie clip
--------------------------------------


yaklaşılacak movie clipin instance name i;  cisim olsun
ve yaklaşacak cisme şu kodları ekleyin;


onClipEvent(load){
 function hyp(x1,x2,y1,y2){
  return Math.sqrt(sq(x2-x1) + sq(y2-y1));
 }

 function sq(n){
  return n*n;
 }

 function trig_move(a,s){
  _x += Math.sin(a*(Math.PI/180))*s;
  _y += Math.cos(a*(Math.PI/180))*s*-1;
 }
}

onClipEvent (enterFrame) {
 dist = hyp(_x,_root.cisim._x,_y,_root.cisim._y);

 if(dist > 2*_width){
  a = Math.atan2(_root.cisim._x-_x,_y-_root.cisim._y)/(Math.PI/180);
  trig_move(a,5);
 }
}

 

 


--------------------------------------
İŞTE ÇIKMIŞ OLAN EN İYİ KOD; çünkü çok fazla işe yarıyor. Oyunlar için bir numaralı kod!

******İF**********KODU*************  -----ERMANSOFT farkıyla-------

onClipEvent (enterFrame) {
    if (this.hitTest(_root.cisim)) {
        _root.gotoAndPlay("frame");
    }
}


animasoyonda bir cimin üstüne bir cisim gelince
istediğiniz kareye gitmesini istiyorsanız. bunu kullanın.

*kodu üstüne gelinecek cisme ekleyin.
*'cisim' kısmı yerine üzerine gelicek olan cismin örnek adını yazın.
*'frame' kısmı yerine frame i yazın

 

-----------------------------------
-----------------------------------
**********PROPERTİES***************
-----------------------------------
-----------------------------------


----------------------------------------------------------
movie clipin belirli eksen yönünde gitmesi
------------------------------------------------------
AÇIKLAMA:
*  _y += (_root.y=0)/speed;      yerlerindeki; y=0 ve x=0 kısımlarına gidecekleri hız ve ekseni belirleyin.    *
*  _x += (_root.x=0)/speed;      Örneğin;   y=10 , x=15 , y+20 , x-40  gibi. y=0 ve x=0 iken cisim hareket etmez.  *
                                                                   

 

onClipEvent (load) {
 speed = 10;
}
onClipEvent (enterFrame) {
 _y += (_root.y=0)/speed;
 _x += (_root.x=0)/speed;
}

 

-----------------------------------------------------------
MOVİECLİPi döndürme 2.0 (ERMANHASKAN tarafından yenilendi)
-----------------------------------------------------------
açılama:
hızını arttırmak için; speed kısmını azaltın.
yönünüdeğiştirmek için;   _rotation+= (_root.rotation+50)/speed; kısmını
                          _rotation+= (_root.rotation-50)/speed; yapın.

 


onClipEvent (load) {
 speed = 10;
}
onClipEvent (enterFrame) {
 _rotation+= (_root.rotation+50)/speed;
}


------------------------------------------------------------------------------------------
NOT:  Yukarıdaki kodları kendiniz; FLASHMX in properties kodları ile değiştirebilirsiniz.
----

,

onClipEvent (load) {                                movieclipi döndüren bu kodu;     onClipEvent (load) {
 speed = 10;                                 şu biçimde----------------)              speed = 10;
}                                                   değiştiriseniz,                  }
onClipEvent (enterFrame) {                          movie clip in yüksekliği         onClipEvent (enterFrame) {
 _rotation+= (_root.rotation+50)/speed;      ile oynarsınız.                       _height+= (_root.height+50)/speed;;
}                                                                                    }


------------------------------
------------------------------
*********SON******************
------------------------------
------------------------------

 

--------------------------------------------------------------
üzerine gelince el işareti çıkmayan buton
---------------------------------------------------
AÇIKLAMA:
aşağıdaki kodu butona ekleyin ama butonununuzun instance name (örnek adı)  mybutton  olsun.

 

on (release, rollOver, rollOut, dragOver, dragOut) {
        mybutton.useHandCursor = false;
}

 

-------------------------------------------------------------
animasyon sırasında kalemle çizim yapabilme (kareye ekleyin)
-------------------------------------------------------------

_root.onMouseMove = function() {
        if (draw) {
                _root.lineStyle(0, 0x000000, 100);
                _root.lineTo(_root._xmouse, _root._ymouse);
        }
};
_root.onMouseDown = function() {
        draw = true;
        _root.moveTo(_root._xmouse, _root._ymouse);
};
_root.onMouseUp = function() {
        draw = false;
};


--------------------------------------------------------------------
EN BAŞTAKI KOD AYARLARIYLA İSTEĞE GÖRE;           (ERMANHASKAN) ---EN--İYİ--KOD---
1-Tiklenen yere istenilen hızla giden,
2-Tiklenen yere istenilen hızla hemen dönerek gitmekyerine kendi dönerek giden,
3-Mouseun peşinden giden ama önünü giderken mousea döndüren,
4-Mouseun peşinden giden ama önünü kendi çevresinde dönerekmose döndüren,
MOVİE CLİP.

Ayarları ilk '}' a kadar olan yerden yapılıyor.
1. seçenek için: clickmode =true  turnmode = false
2. seçenek için: clickmode =true  turnmode = true
3. seçenek için: clickmode =false turnmode = false
4. seçenek için: clickmode =false turnmode = true
olarak ayarlayın.
-------------------------------------------------------------------------

 

onClipEvent (load) {
 // declare and set initial variables and properties
 clickSpot_x = _x;
 clickSpot_y = _y;
 speed = 10;
 clickMode = false;
 turnMode = false;
}
onClipEvent (mouseDown) {
 //
 // set position of target spot when mouse is clicked
 if (clickMode && _root._xmouse>125 && _root._xmouse<465) {
  clickSpot_x = _root._xmouse;
  clickSpot_y = _root._ymouse;
 }
}
onClipEvent (enterFrame) {
 // toggle button icon visibility
 _root.curve._visible=turnMode;
 _root.pointer._visible=!clickMode;
 //
 // deterimine whether target spot is the clicked spot or the mouse pointer
 if (clickMode) {
  gotoSpotX = clickSpot_x;
  gotoSpotY = clickSpot_y;
 } else{
  gotoSpotX = _root._xmouse;
  gotoSpotY = _root._ymouse;
 }
 //
 // calculate angle of current position to target position
 delta_x = _x-gotoSpotX;
 delta_y = _y-gotoSpotY;
 targetRotation = -Math.atan2(delta_x, delta_y)/(Math.PI/180);
 //
 // calculate the two methods of rotation
 if (turnMode) {
  if (_rotation<targetRotation) {
   _rotation += 10;
  }
  if (_rotation>targetRotation) {
   _rotation -= 10;
  }
 } else{
  _rotation = targetRotation;
 }
 //
 // move beetle toward the target and stop when it gets there
 if (Math.sqrt((delta_x*delta_x)+(delta_y*delta_y))>speed) {
  _y -= speed*Math.cos(_rotation*(Math.PI/180));
  _x += speed*Math.sin(_rotation*(Math.PI/180));
 }
 
 
}


-------------------------------------------------
MERKEZİNE YAKLAŞTIKÇA BÜYÜYEN MOVİE CİP
--------------------------------------------

 

onClipEvent (enterFrame) 
{
mouse = _xmouse;
if (mouse<0)
{
mouse = -1*mouse;
}
scale = 200-mouse;
if (scale<100) 
{
scale = 100;
}
if (scale>200) 
{
scale = 200;
}
setProperty ("", _xscale, scale);
setProperty ("", _yscale, scale);
}

 

---------------------------------------------------------
tutup fırlatıla bilen fizik motorlu movie clip
------------------------------------------------

 


on(press){
startDrag("");
dragging=true;
}
on(release, releaseOutside){
stopDrag();
dragging=false;
}
onClipEvent (load) {
_x = Math.random()*30;
_y = Math.random()*30;
xspeed = 20;
rightedge = 550;
leftedge = 0;
yspeed = 20;
topedge = 0;
bottomedge = 400;
drag = .98;
bounce = .9;
gravity = 2;
}
onClipEvent (enterFrame) {
if (!dragging) {
_x = _x+xspeed;
if (_x+_width/2>rightedge) {
_x = rightedge-_width/2;
xspeed = -xspeed*bounce;
}
if (_x-_width/2<leftedge) {
_x = leftedge+_width/2;
xspeed = -xspeed*bounce;
}
_y = _y+yspeed;
if (_y+_height/2>bottomedge) {
_y = bottomedge-_height/2;
yspeed = -yspeed*bounce;
}
if (_y-_height/2<topedge) {
_y = topedge+_height/2;
yspeed = -yspeed*bounce;
}
yspeed = yspeed*drag+gravity;
xspeed = xspeed*drag;
} else {
xspeed = _x-oldx;
yspeed = _y-oldy;
oldx = _x;
oldy = _y;
}
}

 


----------------------------------------------------------
Yön tuşlarıyla SÜRÜLEN HIZLANINCA SÜRÜKLENEN MOVİE CLİP
----------------------------------------------------------

 

onClipEvent (enterFrame) {
 // sağ ve sol dönüş
 if (Key.isDown(Key.RIGHT)) {
  _rotation += 10;
 }
 if (Key.isDown(Key.LEFT)) {
  _rotation -= 10;
 }
 //
 //
 if (Key.isDown(Key.UP)) {
  // hız - dönüş ve yön hesap parmetreleri
  xSpeed += thrust*Math.sin(_rotation*(Math.PI/180));
  ySpeed += thrust*Math.cos(_rotation*(Math.PI/180));
  flames._visible = 1;
  }
  if (Key.isDown(Key.DOWN)) {
  // hız - dönüş ve yön hesap parametreleri
  xSpeed -= thrust*Math.sin(_rotation*(Math.PI/180));
  ySpeed -= thrust*Math.cos(_rotation*(Math.PI/180));
  flames._visible = 1;
 } else {
  // yukarı ok tuşu ile ilgili ek parametreler
  xSpeed *= decay;
  ySpeed *= decay;
  flames._visible = 0;
 }
 //
 // hız limiti
 speed = Math.sqrt((xSpeed*xSpeed)+(ySpeed*ySpeed));
 if (speed>maxSpeed) {
  xSpeed *= maxSpeed/speed;
  ySpeed *= maxSpeed/speed;
 }
 //
 // haraket hesapları
 _y -= ySpeed;
 _x += xSpeed;
 //
 
}
onClipEvent (load) {
 // hız hesapları
 thrust = 1;
 decay = .97;
 maxSpeed = 10;
}

 

 

--------------------------------------------
Mouse doğru dönen movie clip
-----------------------------------------


onClipEvent(load){

 X = this._x;
 Y = this._y;

}
onClipEvent(mouseMove){

 Xm = _root._xmouse;
 Ym = _root._ymouse;

 Xdiff = Xm - X;
 Ydiff = -(Ym - Y);

 radAngle = Math.atan(Ydiff/Xdiff);

 if (Xdiff < 0){
  corrFactor = 270;
 }
 else{
  corrFactor = 90;
 }

 this._rotation = -radAngle*360/(2*Math.PI) + corrFactor;
 updateAfterEvent();
}

 


------------------------------------------
sürükleyip bırakma
--------------------------------------------------

on (press) {
 startDrag(getProperty(_x, _y));
}
on (release) {
 stopDrag();
}

 

 

 


----------------------------------------------
mouse ı yatay düzlemde takip
------------------------------------------


onClipEvent (enterFrame) {
 _x = _x+_xmouse/5;
}


-------------------------------------------------------
mouseyı bi hızlı bir yavaş takip
-----------------------------------------------


onClipEvent (enterFrame) {
 _x = _x+_xmouse/50;
 _y = _y+_ymouse/50;
}

 

| Html Kodlar | Tr.gg | Webmaster | Bedava-Sitem | Html Kod
 
 
Bugün 13 ziyaretçi (108 klik) kişi burdaydı!
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol