Hallo,
Ich bin dabei ein Snakespiel zu machen. Wo der Wurm sich um 360 Grad drehen kann. Das funkioniert dank @Modokan einwandfrei.
Jetzt funkioniert aber der andere Teil des Wurms nicht mehr(der schwanz des wurmes).
Ich habe nur die Steuerung verändert. Hier mal der AS, wenn es funkioniert, ohne 360 Grad Steuerung.
Das der AS vom HEAD
So funkioniert das einwandfrei.
Wenn Ich das Jetzt mit der Steuerung änder(360 Grad), dann funkioniert das nicht mehr.
Hier der AS.
Die 360 Grad Steuerung funkioniert.
Aber der Wurm wird nicht länger, und nach dem ich die 2te Nahrung gegessen habe, gehe ich immer GAMEOVER.
Hier mal die SWF
Hier auch nochmal der AS für den Schwanz des Wurmes.
Wieso funkioniert das so nicht? Was mache ich Falsch?
Ich hoffe mir kann da jemand bei Helfen.
Das wäre echt super, wenn da mal jemand drüber gucken könnte.
Vielen Dank
mfg maeggi07
Ich bin dabei ein Snakespiel zu machen. Wo der Wurm sich um 360 Grad drehen kann. Das funkioniert dank @Modokan einwandfrei.
Jetzt funkioniert aber der andere Teil des Wurms nicht mehr(der schwanz des wurmes).
Ich habe nur die Steuerung verändert. Hier mal der AS, wenn es funkioniert, ohne 360 Grad Steuerung.
Das der AS vom HEAD
PHP:
onClipEvent (load) {
kill = 0;
var count=0;
function replicate () {
count+=1;
if (count>=300) {
count = 0;
}
duplicateMovieClip (_root.tail, "tail"+ count, 10+count);
_root["tail"+count]._x = this._x;
_root["tail"+count]._y = this._y;
if(dir=="right"){_root["tail"+count]._rotation=0}
else
if(dir=="left"){_root["tail"+count]._rotation=180}
else
if(dir=="down"){_root["tail"+count]._rotation=90}
else
if(dir=="up"){_root["tail"+count]._rotation=-90}
}
function checkEdges(){
if (_x>550){this._x=-10}
else if (_x<-15){this._x=540}
else if (_y>400){_y=-10}
else if (_y<-15){_y=380}
}
}
onClipEvent (enterFrame) {
checkEdges()
if(!_root.head.kill){
if (Key.isDown(Key.RIGHT) and dir != "left") {
dir = "right";
speedx = 10;
speedy = 0;
this._rotation=0
replicate ()
} else if (Key.isDown(Key.LEFT) and dir != "right") {
dir = "left";
speedx = -10;
speedy = 0;
replicate ()
this._rotation=180
} else if (Key.isDown(Key.UP) and dir != "down") {
dir = "up";
speedy = -10;
speedx = 0;
replicate ()
this._rotation=260
} else if (Key.isDown(Key.DOWN) and dir != "up") {
dir = "down";
speedx = 0;
speedy = 10;
replicate ()
this._rotation=90
}else {replicate ()}
this._x += speedx;
this._y += speedy;
}
}
Wenn Ich das Jetzt mit der Steuerung änder(360 Grad), dann funkioniert das nicht mehr.
Hier der AS.
PHP:
onClipEvent (load) {
kill = 0;
var count=0;
function replicate () {
count+=1;
if (count>=300) {
count = 0;
}
duplicateMovieClip (_root.tail, "tail"+ count, 10+count);
_root["tail"+count]._x = this._x;
_root["tail"+count]._y = this._y;
}
function checkEdges(){
if (_x>550){this._x=-10}
else if (_x<-15){this._x=540}
else if (_y>400){_y=-10}
else if (_y<-15){_y=380}
}
}
onClipEvent (enterFrame) {
checkEdges()
speed = 5;
if(!_root.head.kill){
if (Key.isDown(Key.RIGHT)) {
this._rotation += 7;
replicate ()
} else if (Key.isDown(Key.LEFT)) {
this._rotation -= 7;
}else {replicate ()}
this._x += speed * Math.cos(this._rotation * (Math.PI / 180));
this._y += speed * Math.sin(this._rotation * (Math.PI / 180));
}
}
Aber der Wurm wird nicht länger, und nach dem ich die 2te Nahrung gegessen habe, gehe ich immer GAMEOVER.
Hier mal die SWF
Hier auch nochmal der AS für den Schwanz des Wurmes.
PHP:
onClipEvent (load){var c=0;}
onClipEvent (enterFrame){
c=c+1;
if ( c>=_root.life){removeMovieClip (this);}
if ( this.hitTest(_root.pill)){_root.pill.change_pos=1;}
if (this.hitTest (_root.head._x,_root.head._y,true))
{_root.head.kill=1;
_root.pill._x=-100;
_root.msg="Game Over";
}
}
Ich hoffe mir kann da jemand bei Helfen.
Das wäre echt super, wenn da mal jemand drüber gucken könnte.
Vielen Dank
mfg maeggi07