lundi 9 janvier 2017

if clicked 1+2 button true or wrong.How I do that

A few fish come to the screen and stop after a while the other fishes come in.Then a while the stage is stopped and the player is trying to guess the first fishes.How can I create code to say that the chosen fish is wrong or true.For example:The first come 3 fishes it's correct and after then came fishes wrong.Player guess right all the fishes and earn coins or display win text bla bla..

I selected to sequence of the fish at timeline.So yes I animated.I was using as3 random function for the display on the screen.

This is a memory game.Fishes (it's buttons ) display on the screen and stop then other fishes ( a wrong fishes ) display.After a while stops all the scene and player choose ( click ) right fishes.So all I need: if clicked button 1 + button2 = true then go to bla bla. if wrong goto bla bla. All in the one order...I don't put code for display to fish,just I put here a button code .

fish1.addEventListener(MouseEvent.CLICK, click1);
fish2.addEventListener(MouseEvent.CLICK, click2);
fish3.addEventListener(MouseEvent.CLICK, click3);
fish4.addEventListener(MouseEvent.CLICK, click4);
fish5.addEventListener(MouseEvent.CLICK, click5);
var PC:Boolean = false;
 
function click1 ( m:MouseEvent ){
PC = true;
}
 
function click2 ( m:MouseEvent ){
PC = true;
}
 
function click3 ( m:MouseEvent ){
PC = true;
}
 
function click4 ( m:MouseEvent ){
PC = true;
}
 
function click5 ( m:MouseEvent ){
if ( PC ) 
{
 
PC = false;
gotoAndPlay (1);
}
} 

Aucun commentaire:

Enregistrer un commentaire