Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash 8

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 10-08-2006, 09:00   #1 (permalink)
Superuser
 
Benutzerbild von Nophytex
 
Registriert seit: Jun 2004
Ort: Hürth
Beiträge: 61
Wieso funktioniert der Spider Script nicht unter Flash 7?

Der da geht so:

Code:
onClipEvent (load) {
	var go = true; // if this var is false, the spider will not move on it's own
	myBounds = _root.boundbox.getBounds(_root);
	var maxspeed = 15; // maximum walking speed
	var friction = 0.96;
	var d = 2;
	var a = 4;
	var n = 1;
	var legn = 1;
	var lega = 2;
	var legd = 2.7;
	// these next 2 lines put the body on top of the lines (just a cosmetic change)
	duplicateMovieClip ("oldbody", "body", 100);
	oldbody._visible = false;
}
onClipEvent (enterFrame) {
	// life code start
	if (go) {
	var change = random(30)+1; // this determines whether he will change direction/speed
	if (change == 5) { //if change is 5, then change the speed/direction of the spider
		var xspeed = (random(maxspeed)+1)-((maxspeed-1)/2);
		var yspeed = (random(maxspeed)+1)-((maxspeed-1)/2);
	}	
	xspeed *= friction;
	yspeed *= friction;
	var newypos = body.char0._y+yspeed;
	var newxpos = body.char0._x+xspeed;
	// check the boundaries
	if (newypos>(myBounds.yMax-_y)) {
		yspeed = -8;
	}
	if (newypos<(myBounds.yMin-_y)) {
		yspeed = 8;
	}
	if (newxpos>(myBounds.xMax-_x)) {
		xspeed = -8;
	}
	if (newxpos<(myBounds.xMin-_x)) {
		xspeed = 8;
	}
	// end bounds check
	body.char0._y = newypos;
	body.char0._x = newxpos;
	} // end life code
	for (i=1; i<=8; i++) {
		// draw the legs
		attachMovie("line", "line"+i, i);
		var myToe = this["toe"+i];
		var myLeg = this["line"+i];
		myLeg._x = body.char1._x;
		myLeg._y = body.char1._y;
		myLeg._xscale = (myToe.char1._x+myToe._x)-body.char1._x;
		myLeg._yscale = (myToe.char1._y+myToe._y)-body.char1._y;
		// end legs
		// move the toes
		var walkdist = random(60)+45;
		xlegdist = Math.abs(myToe.char1._x-body.char1._x);
		ylegdist = Math.abs(myToe.char1._y-body.char1._y);
		if (xlegdist>walkdist || ylegdist>walkdist) {
			walktoX = random(walkdist)-(walkdist/2);
			walktoY = random(walkdist)-(walkdist/2);
			myToe.char0._x = body.char1._x+(walktoX*1.5);
			myToe.char0._y = body.char1._y+(walktoY*1.5);
		}
	}
}
Nophytex ist offline   Mit Zitat antworten
Alt 11-08-2006, 10:25   #2 (permalink)
Superuser
 
Benutzerbild von Nophytex
 
Registriert seit: Jun 2004
Ort: Hürth
Beiträge: 61
Hallo kann mal einer das Flash checken, dürfte noch aus Flash 5 Zeiten stammen, soll aber jetzt unter Flash 7 laufen.

Handelt sich um dieses Spinnen Script, wo sone Spinne rumläuft.
Kann euch auch gerne die Fla schicken,wenns auch weiterhilft, aber das sollte das ganze wichtige AS gewesen sein!!
Nophytex 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



Alle Zeitangaben in WEZ +1. Es ist jetzt 18:13 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele