Anyone knows this script?

  • perloader
  • Newbie
  • Newbie
  • perloader
  • Posts: 10

Post 3+ Months Ago

Firstly timing_mc is counting 10 to 0 and when it 0 the person_mc shouldnt move if it moves then back to the start point else keep moving.

how to write this script i need it so bad please anyone help me out with that
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Code: [ Select ]
if(someVariable >0){
 person_mc.someFunction();
}else{
person_mc.stop();
}
  1. if(someVariable >0){
  2.  person_mc.someFunction();
  3. }else{
  4. person_mc.stop();
  5. }


simply tests if some variable is greater than 0. If it is you keep the clip moving and if its not (IE equal to 0) you want it to stop.

We'd need a lot more information to actually help you make this work.
  • perloader
  • Newbie
  • Newbie
  • perloader
  • Posts: 10

Post 3+ Months Ago

Firstly thx for help

i m actualli making a game that when the person A is walking while person B is counting 10 to 0 but when Person B is stop at 0 then person A shouldnt move. person A has to stop but if person A walk while at da 0 then back to the start else keep counting and person A can keep walking until reach the goal.

So i named my person B is timing_mc person A is person_mc
what else information should i give out?

please help
  • perloader
  • Newbie
  • Newbie
  • perloader
  • Posts: 10

Post 3+ Months Ago

What is wrong with my code why it stop at 0 but not keep continous of counting?
but i want at 0 stop 1 sec then re count


function updateTimer() {
mc_timing.timer--;
if(mc_timing.timer<=0) {
gameover = true;
person_mc.gotoAndStop(1);
}
}
function restart() {
person_mc._x = 366.6;
person_mc._y = 488.4;
timerCounter = 12;
mc_timing.timer = 10;
gameover = false;
person_mc.play();
}
Key.addListener(KeyListener);

this.onEnterFrame = function():Void {
if(!gameover) {
timerCounter--;
}
if(timerCounter<0) {
updateTimer();
timerCounter = 12;
}
if (isMoving) {
movePerson(person_mc);
}
update(person_mc);
moveRock();
moveRock2();
};
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

You should use a setInterval() to create a timer. Its a lot more accurate than trying to rely on the framerate to get the time. And you don't really have to do the counter then.

setInterval Tutorial

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.