PDA

View Full Version : probability and games!


jaygobloom
11-29-2007, 11:29 AM
Hi
I am having difficulty getting to grips with a new project! I am panning on making an online consultation game with a bunch of Scottish kids called 'aye but no but'

The way i see it is that on the screen you have three buttons 'AYE' 'NO' & 'STOP' and one image. The image changes with each press of the 'AYE' or 'NO' buttons and with the 'STOP' button brings all those images clicked 'AYE' to together to form one picture.

Can anyone point me in the right direction as to what i need to look at for this to happen? I am sure it will be something that is called upon pressing the 'STOP' button which links to a handler which is placed on a certain movieclip at the time of the 'AYE' button being pressed.

Are their any similar examples anyone can think of? and does it sound possible!!
Thanks in advance JAYGO

grass
12-01-2007, 06:45 PM
well as I understand You have some images that have correct answers? As sometimes aye , sometimes not?

anyhow code looks simple enough....


//array of image url + true answer to the image...
images = [["img1.jpg","aye"],["img2.jpg","no"], ["img3.jpg","aye"]];

//listener of answers
function changeImage(what) {
if(images[currentObj][1]==what) {
//answer was true
loadNewRandomImage();
//load a newone here or something
} else {
//wasnt true
}
}

aye_button.onRelease=function() {
changeImage("aye");
}

no_button.onRelease=function() {
changeImage("no");
}

imgLoader = new MovieClipLoader();

function loadNewRandomImage() {
//loads a random image into movieclip called "someMC"
currentObj = int(Math.random()*images.length);
imgLoader.loadClip(images[currentObj][0],someMC);
}

loadNewRandomImage();



if i understood you correctly, this is a start...

jaygobloom
12-03-2007, 03:53 PM
thanks grass
all images can be either 'aye' or 'no'
depending on what button the player presses when they see the image on stage.
but only on pressing the stop button will it bring all those images thats have been
clicked 'aye' to together to make one composition. i.e. all seen on the stage at once.
Your script is going to help me
I will work on it, but i think i still will need help understanding how to assign the 'aye' or 'no' label onto any image by pressing the right button, The one above seems to present the images as either aye or no and not with the option to change am i right?

regards J

grass
12-06-2007, 11:59 AM
something like that...

anyhow, there is a right click detector for flash (dun remember, search) but you cant have a right click without contextmenu... so you should check coding for it



asd = new ContextMenu();
asd.hideBuiltInItems = true;
asd.customItems.push(new ContextMenuItem("do something",funcName));