Jump to content


Game help


  • You cannot reply to this topic
1 reply to this topic

#1 MAdEinUK1

    Young Padawan

  • Members
  • Pip
  • 74 posts

Posted 29 October 2006 - 05:27 PM

Hi,

Im trying to make a fairly simple game in flash.

I dont really a clue what to do.

The story is:


Its 4:30pm and our teacher wont let us go home. :)

So the only way for us to get out of the class is to sneak out.
The person who manages to get out of the class first in the quickest time. Gets 1st place on the leaderboard.

My first intial idea of the the game. Is for him to turn his head to the drawing board giving us time to escape, however if he sees you moving your character its game over.

Im not worried about about the leaderboard atm.

But I have made this code so far:



stop();


me_mc.onPress = function() {
this.startDrag();
};
me_mc.onRelease = function() {
this.stopDrag();
start_time = getTimer();
if (this.hitTest(door_mc)) {
trace("Well done, you escaped");
gotoAndStop("win");
running_time = _root.timer_txt;
player_name = _root.playername;
}
};

I would really apperciate it if someone could help me out :)

Thanks,

MAdEinUK1

#2 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 30 October 2006 - 12:41 AM

Add this to your code:
//Create a new variable
var randCatch:Number;
//Create a loop
onEnterFrame = function() {
//Keep randomising a number inside this variable
//Increasing the number will make the teachers head turn less often, and vice-versa
randCatch = random(150);
//Ask when the teachers head is moved
if(teachHead._currentframe == 2) {
//trace("He caught you!");
//Other actions
}
//Ask when the random number is below or equal to 50
if(randCatch <= 50) {
//Change the frame of the teachHead movieclip
teachHead.gotoAndStop(2);
} else {
//Set the teachers head normal
teachHead.gotoAndStop(1);
}
//End loop
}
Then make the teachers head a movieclip; on the first frame make it face the board, the second frame make it turned around.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users