如果点击1 + 2按钮是真的还是错的,我怎么做的 [英] if clicked 1+2 button true or wrong.How I do that
问题描述
$ b $我选择了在时间线上的鱼序列。所以是的,我动画。我使用as3随机函数在屏幕上显示。
这是一个记忆游戏。在屏幕上显示鱼(它的按钮),然后停止其他鱼(错误的鱼)显示。一段时间停止所有的场景和玩家选择(点击)右边的鱼。所有我需要的:如果点击按钮1 + button2 = true,然后去bla bla。如果错了,转到bla bla。所有在一个订单...我不把放在鱼的代码,只是我在这里放一个按钮代码。
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;
函数click1(m:MouseEvent){
PC = true;
函数click2(m:MouseEvent){
PC = true;
}
函数click3(m:MouseEvent){
PC = true;
函数click4(m:MouseEvent){
PC = true;
函数click5(m:MouseEvent){
if(PC)
{
PC = false;
gotoAndPlay(1);
$ div $解析方案
简单。所以你知道有多少鱼是正确的,所以使用
//正确鱼的数量
var correctFishesCount:int = 3;
//向这个临时计数添加一个数字来检查用户是否预测了所有的鱼
var userCount:int = 0;
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 addUserCount(){
userCount ++;
if(userCount == correctFishesCount)
我们有一个赢家
}
函数click1(m:MouseEvent){
PC = true;
addUserCount()
}
函数click2(m:MouseEvent){
PC = true;
addUserCount()
}
函数click3(m:MouseEvent){
PC = true;
addUserCount()
}
函数click4(m:MouseEvent){
PC = true;
addUserCount()
}
函数click5(m:MouseEvent){
if(PC)
{
PC = false;
gotoAndPlay(1);
}
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);
}
}
It's easy. So you know how many fishes are CORRECT right , so use
//number of correct fishes
var correctFishesCount:int = 3;
//add a number to this temporary count to check whether user predicted all fishes
var userCount:int = 0;
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 addUserCount(){
userCount++;
if(userCount == correctFishesCount)
We Have a winner
}
function click1 ( m:MouseEvent ){
PC = true;
addUserCount()
}
function click2 ( m:MouseEvent ){
PC = true;
addUserCount()
}
function click3 ( m:MouseEvent ){
PC = true;
addUserCount()
}
function click4 ( m:MouseEvent ){
PC = true;
addUserCount()
}
function click5 ( m:MouseEvent ){
if ( PC )
{
PC = false;
gotoAndPlay (1);
}
这篇关于如果点击1 + 2按钮是真的还是错的,我怎么做的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!