Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 26-10-2009, 17:32   #1 (permalink)
zusammen sind wir stark
 
Registriert seit: Nov 2001
Ort: irgendwo in niedersachsen
Beiträge: 146
sehe nicht durch

Hallo ich hab hier ein Script und will die Spinne über ein Hintergrundbild laufen lassen..... nur finde ich nicht die stelle wo es eingefügt werden muss.
Hintergrundbild soll ein Holzbrett sein...... bitte helft mir mal mein Brett Wegzugekommen...danke





Math.easeInOutQuad = function (t, b, c, d){
if ((t/=d/2) <1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2)-1) + b;
};
Math.fixAngle = function (angle) {
angle %= 360;
return (angle < 0) ? angle + 360 : angle;
};

numWalkers=1;
stride=50;
legHeight=8;
buffer=50;
stepHeight=6;
//frames between steps
wait=2;
//make sure the number of legs is even
walkCycle=new Array({leg:"R2",length:35},{leg:"L1",length:25},{l eg:"L3",length:30},{leg:"R4",length:25},{leg:"R1", length:25},{leg:"L2",length:35},{leg:"R3",length:3 0},{leg:"L4",length:25});
numLegs = walkCycle.length;
for(i=1;i<=_root.numWalkers;i++){
_root.createEmptyMovieClip("body"+i,depth++);
for(j=0;j<_root.numLegs;j++){
_root["body"+i].createEmptyMovieClip(_root.walkCycle[j].leg,depth++);
_root["body"+i][_root.walkCycle[j].leg].length=_root.walkCycle[j].length;
}
_root["body"+i]._x=Math.random()*Stage.width;
_root["body"+i]._y=Math.random()*Stage.height;
_root["body"+i].angle=_root["body"+i]._rotation=Math.random()*360;
_root["body"+i].resetMove=function(){
for(j=1;j<=(_root.numLegs/2);j++){
delete this["R"+j].onEnterFrame;
delete this["L"+j].onEnterFrame;
this["R"+j].beginX=false;
this["L"+j].beginX=false;
this["R"+j].time=0;
this["L"+j].time=0;
}
this.setLegs();
};
_root["body"+i].setLegs=function(){
var legAngle = 360/(2+_root.numLegs);
for(j=1;j<=(_root.numLegs/2);j++){
this["R"+j].shadow_x=this["R"+j].x=this._x-(Math.sin((this.angle-90+(legAngle*j))*(Math.PI/180))*this["R"+j].length);
this["R"+j].shadow_y=this["R"+j].y=this._y+(Math.cos((this.angle-90+(legAngle*j))*(Math.PI/180))*this["R"+j].length);
this["L"+j].shadow_x=this["L"+j].x=this._x+(Math.sin((this.angle+90-(legAngle*j))*(Math.PI/180))*this["L"+j].length);
this["L"+j].shadow_y=this["L"+j].y=this._y-(Math.cos((this.angle+90-(legAngle*j))*(Math.PI/180))*this["L"+j].length);
}
};
_root["body"+i].setLegs();
_root["body"+i].onEnterFrame = walk;
_root["body"+i].duration = 9+(int(Math.Random()*4));
_root["body"+i].angleSpeed = 20+(int(Math.Random()*10));
}
function move(){
if(!this.beginX){
this.beginX=this.shadow_x;
this.changeX=this.targetX-this.beginX;
this.beginY=this.shadow_y;
this.changeY=this.targetY-this.beginY;
}
this.shadow_x=Math.easeInOutQuad(this.time++,this. beginX,this.changeX,this._parent.duration);
this.shadow_y=Math.easeInOutQuad(this.time,this.be ginY,this.changeY,this._parent.duration);
this.footHeight = _root.stepHeight*Math.sin((this.time/this._parent.duration)*Math.PI);
this.x = this.shadow_x;
this.y = this.shadow_y-this.footHeight;
if (this.time>this._parent.duration){
this.beginX=false;
this.time=0;
delete this.onEnterFrame;
}
};
function walk(){
if(this._x>(Stage.width+_root.buffer)){
this._x=-_root.buffer/1.5;
this.resetMove();
}
if(this._x<-_root.buffer){
this._x=Stage.width+(_root.buffer/1.5);
this.resetMove();
}
if(this._y>(Stage.height+_root.buffer)){
this._y=-(_root.buffer/1.5);
this.resetMove();
}
if(this._y<-_root.buffer){
this._y=Stage.height+(_root.buffer/1.5);
this.resetMove();
}
var totX;
var totY;
for(i=1;i<=(_root.numLegs/2);i++){
totX+=this["L"+i].shadow_x;
totY+=this["L"+i].shadow_y;
totX+=this["R"+i].shadow_x;
totY+=this["R"+i].shadow_y;
}
this._x=totX/_root.numLegs;
this._y=totY/_root.numLegs;

//rear coordinates
var aveX1 = (this.L4.shadow_x + this.R4.shadow_x)/2;
var aveY1 = (this.L4.shadow_y + this.R4.shadow_y)/2;
var bodyAngle=Math.atan2((this._y-aveY1),(this._x-aveX1))+Math.PI;
this.rear_x = this._x + 18/2*Math.cos(bodyAngle);
this.rear_y = this._y + 18/2.5*Math.sin(bodyAngle);
this.rear2_x = this._x + 25/2*Math.cos(bodyAngle);
this.rear2_y = this._y + 25/2.5*Math.sin(bodyAngle);

if (this.counter==_root.wait){
var currLeg=_root.walkCycle[this.leg].leg;
var legLength=_root.walkCycle[this.leg].length;
//randomly change direction
if ((int(Math.random()*8)+1 == 8)&&(currLeg.charAt(1)=="1")){
(Math.round(Math.random())) ? this.angle-=this.angleSpeed : this.angle+=this.angleSpeed;
this.angle = Math.fixAngle(this.angle);
}
(this.leg<(_root.numLegs-1)) ? this.leg++ : this.leg=0;
(currLeg.charAt(0)=="R") ? this.side=-1 : this.side=1;
var legStride = _root.stride - ((currLeg.charAt(1))-1)*(_root.stride/(_root.numLegs/3));
var dest_x=this._x+(Math.cos(this.angle*(Math.PI/180))*(legStride));
var dest_y=this._y+(Math.sin(this.angle*(Math.PI/180))*(legStride));
this[currLeg].targetX=dest_x+(this.side*(Math.sin(this.angle*(M ath.PI/180))*legLength));
this[currLeg].targetY=dest_y-(this.side*(Math.cos(this.angle*(Math.PI/180))*legLength));
this[currLeg].onEnterFrame = move;
}
(this.counter<_root.wait) ? this.counter++ : this.counter = 0;
};
onEnterFrame = function(){
_root.clear();
var i=1;
for(i=1;i<=_root.numWalkers;i++){
//shadow
_root.lineStyle(8, 0x979698, 20);
_root.moveTo(_root["body"+i]._x, _root["body"+i]._y);
_root.lineTo(_root["body"+i]._x+.5, _root["body"+i]._y);
_root.lineStyle(13, 0x979698, 20);
_root.moveTo(_root["body"+i].rear_x, _root["body"+i].rear_y);
_root.lineTo(_root["body"+i].rear2_x, _root["body"+i].rear2_y);

_root.lineStyle(3, 0x979698, 25);
for(j=1;j<=(_root.numLegs/2);j++){
_root.moveTo(_root["body"+i]["R"+j].shadow_x, _root["body"+i]["R"+j].shadow_y);
_root.lineTo(_root["body"+i]._x, _root["body"+i]._y);
_root.moveTo(_root["body"+i]["L"+j].shadow_x, _root["body"+i]["L"+j].shadow_y);
_root.lineTo(_root["body"+i]._x,_root["body"+i]._y);
}
_root.lineStyle(1, 0x333333, 100);
for(j=1;j<=(_root.numLegs/2);j++){
_root.moveTo(_root["body"+i]["R"+j].x, _root["body"+i]["R"+j].y);
_root.curveTo(_root["body"+i]["R"+j].x, _root["body"+i]["R"+j].y-15, _root["body"+i]._x, _root["body"+i]._y-_root.legHeight);
_root.moveTo(_root["body"+i]["L"+j].x, _root["body"+i]["L"+j].y);
_root.curveTo(_root["body"+i]["L"+j].x, _root["body"+i]["L"+j].y-15, _root["body"+i]._x, _root["body"+i]._y-_root.legHeight);
}
_root.lineStyle(5, 0x333333, 100);
_root.moveTo(_root["body"+i]._x, _root["body"+i]._y-_root.legHeight);
_root.lineTo(_root["body"+i]._x+.5, _root["body"+i]._y-_root.legHeight);
_root.lineStyle(10, 0x6C020B, 100);
_root.moveTo(_root["body"+i].rear_x, _root["body"+i].rear_y-_root.legHeight);
_root.lineTo(_root["body"+i].rear2_x, _root["body"+i].rear2_y-_root.legHeight);
}
};
giand ist offline   Mit Zitat antworten
Alt 27-10-2009, 16:11   #2 (permalink)
zusammen sind wir stark
 
Registriert seit: Nov 2001
Ort: irgendwo in niedersachsen
Beiträge: 146
??? keiner.......oder ist an der frage was falsch?
giand ist offline   Mit Zitat antworten
Alt 27-10-2009, 18:38   #3 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Ja. Die Frage ist ein bisschen schwer zu verstehen.
Wo hast Du das Script her?
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 27-10-2009, 18:40   #4 (permalink)
Nix Wisser
 
Benutzerbild von nullidee
 
Registriert seit: May 2003
Ort: Würzburg, Kleinstadt
Beiträge: 3.510
zeig doch lieber eine .fla

den Code in einem Beitrag bitte mit [CODE] oder [PHP] formatieren
__________________
nullidee

Abakus GT 10² Kugeln - 80"Leinwand - CARAN D´ACHE SUPRACOLOR®
nullidee ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
sehe MCs wenn Exe nicht bildschirmfüllend saoirse Flash Einsteiger 2 06-02-2007 19:19
swf importieren , wieso sehe ich es nicht ? InTruster Flash Einsteiger 7 24-05-2006 17:44
sehe in homepage den Movieclip nicht abendrot Flash 4 und Flash 5 2 08-10-2004 12:30
swf ladet nicht ein oder sehe es nicht! sirius1 Flash MX 11 12-01-2004 17:54
Externe texte funzt einfach nicht... und ich sehe es nicht pampers Flash 4 und Flash 5 10 22-07-2003 12:48


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:24 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele