PDA

View Full Version : Help With a Game


Daisuke
06-25-2008, 02:58 PM
Hello, I'm currently working on a little Flash Game as a part of my coursework.
The game works buy dragging 3 items into a pot to create little pet creatures, I have the I have everything working except for the actual creation of the creature ...

I need a bit of code that makes it so that after the 3 items are selected [dropped into the pot] the game will create the creature, and the game will give you a choice whether or not you'd like to create a new creature.

There are 7 items and 13 creatures ...

Thanks for the help ^^

Jeremy78
06-25-2008, 04:53 PM
xxneon would probably be best at answering this but I can give the concept a stab. First you would need something that constantly checks the state of the "pot" for number of elements within it, onEnterFrame or hitTest. You would write a loop and condition.. I am horrible at writing code I can edit it better but I'll give that a stab.


function createAnimal() {
for (var i = 0; i < _length, i++) {
var myMC = i;
var pot_mc = this._length;
if (pot_mc >= 3) {
this = pot_mc[i];
}
}
};
pot_mc.onEnterframe = function() {
createAnimal();
}


But I may be WAY off. I didn't test it I just did it from my head, if it doesn't work Im sure someone will be by that knows what they are doing.
I think there would need to be an eventListener to.. but I already know I'm wrong but I hope I'm partly right.

Daisuke
06-25-2008, 11:00 PM
thank you for all your help.

im afraid it wasnt what i needed, but i am greatful that your tried helping ^^

:)