Bonjour,
Je suis étudiante et j'ai comme option un cours se passant à l'ordinateur, où l'on utilise Flash CS3 comme outil de travail. Personne n'est vraiment habile avec le logiciel, à part les gens qui ont déjà travaillé avec cela. Pour ma part, je n'ai jamais touché à ce genre de truc.
Mais voilà, je suis en retard pour mon projet qui est de créer un labyrinthe où une coccinelle doit se rendre jusqu'à la sortie de celui-ci. Or, cela fait plus de 3-4 jours que je tente de faire fonctionner cela sans succès : ma coccinelle bouge ; mais elle passe au travers des murs. Ma coccinelle est aussi supposée être capable de manger des insectes et des feuilles (clip) qui disparaissent par la suite. Mais ça ne fonctionne pas non plus. Et à chaque truc de mangé, le joueur obtient des points... mais mon compteur refuse aussi d'augmenter.
J'ai fait exactement la même chose que la professeur nous a montré, mais rien ne fonctionne. J'ai donc recommencé mon labyrinthe avec quelque chose de plus simple, mais... voilà, j'ai toujours les mêmes problèmes.
Voici le code que j'ai mit pour que ma coccinelle ne traverse pas les murs :
[code]onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x = this._x+10;
if(
(this.hitTest(_root.carre1))
||(this.hitTest(_root.carre2))
||(this.hitTest(_root.cotegauche))
||(this.hitTest(_root.cotehaut))
||(this.hitTest(_root.Carre4))
||(this.hitTest(_root.cotebasd))
||(this.hitTest(_root.Carre5))
||(this.hitTest(_root.cotebasg))
||(this.hitTest(_root.cotedroite))
||(this.hitTest(_root.Carre3)))
{
this._x = this._x-10;
}
}
if (Key.isDown(Key.LEFT)) {
this._x = this._x-10;
if(
(this.hitTest(_root.carre1))
||(this.hitTest(_root.carre2))
||(this.hitTest(_root.cotegauche))
||(this.hitTest(_root.cotehaut))
||(this.hitTest(_root.Carre4))
||(this.hitTest(_root.cotebasd))
||(this.hitTest(_root.Carre5))
||(this.hitTest(_root.cotebasg))
||(this.hitTest(_root.cotedroite))
||(this.hitTest(_root.Carre3)))
{
this._x = this._x+10;
}
}
if (Key.isDown(Key.UP)) {
this._y = this._y-10;
if(
(this.hitTest(_root.carre1))
||(this.hitTest(_root.carre2))
||(this.hitTest(_root.cotegauche))
||(this.hitTest(_root.cotehaut))
||(this.hitTest(_root.Carre4))
||(this.hitTest(_root.cotebasd))
||(this.hitTest(_root.Carre5))
||(this.hitTest(_root.cotebasg))
||(this.hitTest(_root.cotedroite))
||(this.hitTest(_root.Carre3)))
{
this._y = this._y+10;
}
}
if (Key.isDown(Key.DOWN)) {
this._y = this._y+10;
if(
(this.hitTest(_root.carre1))
||(this.hitTest(_root.carre2))
||(this.hitTest(_root.cotegauche))
||(this.hitTest(_root.cotehaut))
||(this.hitTest(_root.Carre4))
||(this.hitTest(_root.cotebasd))
||(this.hitTest(_root.Carre5))
||(this.hitTest(_root.cotebasg))
||(this.hitTest(_root.cotedroite))
||(this.hitTest(_root.Carre3)))
{
this._y = this._y-10;
}
}
}[/code]
Mais... elle continue de passer au travers de murs. J'ai 5 carrés qui sont enregistré en clip dans la bibliothèque, et 5 côtés (le côté bas étant séparé en deux)
Une image de mon jeu : [url]http://i71.servimg.com/u/f71/11/21/72/88/flashc10.png[/url]
Quelqu'un pourrait-il m'aider? Déjà juste arriver à ne pas faire passer ma coccinelle au travers des murs serait un bon début, puisque je ne vois pas ce qui cloche. J'ai un calque pour chaque item de mon labyrinthe, sauf les carrés qui sont sur le calque "labyrinthe".