PDA

View Full Version : help! how do i make a 'poke' game?



mordaut
October 18th, 2004, 08:18 PM
i was wondering what i would need to do to make a game where the player would just poke the character by pressing a button or clicking. after a certain amount of poking the character would suddenly do something like yell.

here's an example of what i want to be able to do: Penguin Game

thanks,
mordaut

mordaut
October 18th, 2004, 08:42 PM
ok ive got the poking working.

the only thing i need help with now is how to make so that when the guy is poked 15 times or so, the movie clips plays frame 30.

i tried variables with stress = 1 and on release stress = stress + 1 and if(stress>15)go to and play blah blah blah...

maybe i am doing it wrong but none of it seems to be working...

plz help,
mordaut

JoMan
October 19th, 2004, 12:14 AM
Maybe try:


StartGame();

function StartGame() {
stress = 0;

_root.onEnterFrame = ButtonPress;
}

function ButtonPress() {
if (stress<=15) {
button.onPress = function() {
stress++;
};

} else {
enemy.gotoAndStop(30);
}

//end//

}



Hope that helps :).





peace

Dr Warm
October 19th, 2004, 05:04 AM
i thought u meant pokemon game, man i'm a nerd!

anyways i prefer to do it like this:

<code></code>
StartGame();

function StartGame() {
stress = 0;
started = true;
}
_root.button.onRelease = function(){
if(started){
if(stress <15){
stress += 1;
} else {

_root.penguin.gotoAndStop(30);
started = false;
}
}
} but either way is fine<code>
</code>

mordaut
October 19th, 2004, 08:26 AM
YES!

it works!

thanks so much you guys!

now the only thing is that i have the actionscript for the button make it go to animation.gotoAndPlay(15) on press and (1) on release. so after ive pressed him 15 times and it goes to to frame 30, which is super cool, if i press the button it starts going to frame 15 and 1 blah blah blah.

is there anyway i can make it so like when stress <15 the button is disabled?

Dr Warm
October 19th, 2004, 08:41 AM
in mine you could change it to _root.started = true; and _root.started everywhere else too

then in ur button have onRelease (i assume ur doing this) {
if(_root.started){
//goto frame whatever;
}
then same for onPress

do u understand?

JoMan
October 19th, 2004, 10:14 AM
i thought u meant pokemon game, man i'm a nerd!
<CODE>
</CODE>
LOL! That's exactly what I thought before I read the post! Man, I must be a nerd too :tb:!





peace

JoMan
October 19th, 2004, 10:19 AM
What I would do, is just put the "hero's" name under the buttonPress function:



StartGame();

function StartGame() {
stress = 0;
poking = true;

_root.onEnterFrame = ButtonPress;
}

function ButtonPress() {
if (stress<=15 && poking) {
button.onPress = function() {
goodGuy.gotoAndPlay(//whatever number you have//);
stress++;
};

} else {
poking = false;
enemy.gotoAndStop(30);
}

button.onRelease = function() {
goodGuy.gotoAndStop(1);
};

//end//

}
</FONT>

Dr Warm
October 19th, 2004, 10:23 AM
now the only thing is that i have the actionscript for the button make it go to animation.gotoAndPlay(15) on press and (1) on release maybe i read it wrong but i thought he had two buttons? one the guy and another one (for sum reason!)

JoMan
October 19th, 2004, 10:28 AM
maybe i read it wrong but i thought he had two buttons? one the guy and another one (for sum reason!)
??? Now your getting me confused! What I thought he had, was a button, a hero, and a badguy.





peace