Déjà Bonjours,
j'ai un problème sur mon jeu flash
- quand je presse (flèche du haut) mon perso avance
- quand je presse (flèche de droite ou gauche) mon perso tourne
- quand je presse (espace) mon perso tir avec son gun
tout marche sur ce point.
Mais quand j'avance, je tourne et tire flash ne calcule pas tout
Voila le code :
<code>onClipEvent (load) {
x = 0;
y = 0;
}
onClipEvent (enterFrame) {
posx = this._x;
posy = this._y;
vitesse = 0;
if (Key.isDown(Key.UP)) {
_root.perso.play();
vitesse = 4;
}
if (Key.isDown(Key.DOWN)) {
_root.perso.play();
vitesse = -2;
}
if (Key.isDown(Key.LEFT)) {
_root.perso._rotation -= 8;
}
if (Key.isDown(Key.RIGHT)) {
_root.perso._rotation += 8;
}
if (Key.isDown(Key.SPACE)) {
_root.perso.gun.play();
}
x = Math.cos(_rotation*(Math.PI/180))*vitesse;
y = Math.sin(_rotation*(Math.PI/180))*vitesse;
_x += x;
_y += y;
for (i=1; i<=8; i++) {
var un_point:Object = new Object();
un_point.x = this['point_'+i]._x;
un_point.y = this['point_'+i]._y;
this.localToGlobal(un_point);
if (_root.ob.hitTest(un_point.x, un_point.y, true)) {
this._x = posx;
this._y = posy;
}
}
}
<code/>