PDA

Volledige versie bekijken : flip horizontal in AS


Fatty Owl
%Europe/Berlin %435 %2005, 11:27
vraagje: kan je d.m.v. AS een movieclip laten flip horizontal doen(sorry voor de syntax:))
dit is mijn code op dit moment als dit van belang is:
var stage = 1;
var positionwesp = _root.wesp_mc._x;
var positionwesp2 = 1000;
_root.wesp_mc.onEnterFrame = function() {
if (positionwesp>30) {
this._x -= stage*5/2;
positionwesp -= stage*5/2;
} else {
positionwesp2 = _root.wesp_mc._x;
positionwesp = 0;
}
if (positionwesp2<314) {
this._x += stage*5/2;
} else {
positionwesp = _root.wesp_mc._x;
}
};dit werkt perfect alleen gaat hij bij het 2de deel van de code(if (positionwesp2<314),...)achteruitvliegen.

Tha Narie
%Europe/Berlin %459 %2005, 12:01
mc._xscale = -mc._xscale;
Op -100 zetten dus.

Fatty Owl
%Europe/Berlin %536 %2005, 13:52
dit is mijn volledige code op frame 1 nu: stop();
var positionwesp = _root.wesp_mc._x;
var positionwesp2 = 1000;//eerst stond hier 20 zodat er 2 if else acties begonnen die
//het tegenovergestelde deden van elkaar. (1000 is gewoon een getal boven 314)
var teller = 0;
var totalescore = 0;
var fliphorizontal = 0;
var flip2 = 0;
var tijd = 20;
var score = 0;
var stage = 1;
_root.onEnterFrame = function() {
if (flip2 == 4) {
_root.wesp_mc._xscale = -_root.wesp_mc._xscale;
}
if (fliphorizontal == 1) {
_root.wesp_mc._xscale = -_root.wesp_mc._xscale;
flip2 = 2;
}
if (tijd == 0) {
gotoAndStop("gameover");
tijd = 0;
}
if (teller == 12) {
tijd -= 1;
teller = 0;
}
if (score>9) {
stage += 1;
tijd += 10;
score = 0;
}
};
_root.wesp_mc.onEnterFrame = function() {
_root.teller += 1;
if (positionwesp>30) {
flip2 += 2;
this._x -= stage*5/2;
positionwesp -= stage*5/2;
} else {
positionwesp2 = _root.wesp_mc._x;
positionwesp = 0;
}
if (positionwesp2<314) {
this._x += stage*5/2;
fliphorizontal += 1;
flip2 = 0;
} else {
positionwesp = _root.wesp_mc._x;
fliphorizontal = 0;
}
};
hij werkt bijna perfect, het enige probleem is dat de wesp pas na 12 seconden, of als positionwesp 0 is, begint te vliegen. daarvoor hangt hij gewoon in de lucht???
//edit: ik heb het probleem zelf opgelost.(zie code)