Forum Topic: onClipEvent(Loads cene)?

(109 views • 5 replies)

This topic is 1 page long.

<< < > >>
Resigned

RedPengy

Reply To Post Reply & Quote

Posted at: 6/21/08 05:19 PM

RedPengy NEUTRAL LEVEL 07

Sign-Up: 11/19/06

Posts: 31

I successfully made a platformer engine, but the code in the engine contains an onClipEvent(Load)
in it. I realized soon enough that load means load movie, instead of load scene. How do I make something like onClipEvent(Loadscene)? I need to know this if I'm going to make a game with a menu, and multiple levels. :P


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/21/08 05:46 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

try

ocClipEvent(enterFrame) {

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

RedPengy

Reply To Post Reply & Quote

Posted at: 6/21/08 06:01 PM

RedPengy NEUTRAL LEVEL 07

Sign-Up: 11/19/06

Posts: 31

That won't work. That makes the code activate every frame. I only want the code to activate when the scene loads.


Goofy

zrb

Reply To Post Reply & Quote

Posted at: 6/21/08 06:04 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

That won't work. That makes the code activate every frame. I only want the code to activate when the scene loads.

Unless I'm mistaken, there is no such thing.
Good attempt though.

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

GuyWithHisComp

Reply To Post Reply & Quote

Posted at: 6/21/08 06:09 PM

GuyWithHisComp LIGHT LEVEL 27

Sign-Up: 11/10/05

Posts: 4,008

onClipEvent(load) doesn't execute when the movie is loaded, rather when the MovieClip is loaded. So if you have a seperate MovieClip on the new scene you should be fine with onClipEvent(load)

BBS Signature

None

RedPengy

Reply To Post Reply & Quote

Posted at: 6/21/08 06:39 PM

RedPengy NEUTRAL LEVEL 07

Sign-Up: 11/19/06

Posts: 31

Hmm, well I tried it but it still didn't work. I guess it's not the onClipEvent(load) that is causing the problem I'm having. Ok, I guess I'll start explaining and hope for some help. :P

If the scene with the engine is NOT the first scene in the movie, the character always goes to a frame when he's not supposed to. For instance, the character is not moving, but he's in the running animation. If I set it back to the first scene, everything works fine. Here's the code.

onClipEvent(load){
	scale = _xscale;
	isJumping = false;
	jumpSpeed = 0;
	time = 0;
	fallSpeed = 0;
	falling = true;
}
onClipEvent(enterFrame){
				  if(Key.isDown(Key.LEFT)){
					  _xscale = -scale;
								this._x=_x-10
				  }
				  if(Key.isDown(Key.RIGHT)){
					  _xscale = +scale;
					  this._x=_x+10
				  }
				  if(Key.isDown(Key.RIGHT)||Key.isDown(Key.LEFT)){
														gotoAndStop(2);
														}else{
															gotoAndStop(1);
														}
	if(isJumping == true){
		gotoAndStop(3);
		time+=1;
		this._y-=jumpSpeed
		jumpSpeed = 15;
	}
	if(Key.isDown(Key.UP)){
		isJumping = true;
	}
	if(_root.plat.hitTest(_root.player._x, _root.player._y, true)){
		isJumping = false;
		falling = false;
		time = 0;
		fallSpeed = 0;
		if(Key.isDown(Key.UP)){
			isJumping = true;
		}
	}else{
		falling = true
	}
	if(falling == true){
		this._y+=fallSpeed
		fallSpeed+=1;
		if(fallSpeed == 20){
			gotoAndStop(3);
		}
	}
}
onClipEvent(keyUp){
	gotoAndStop(1);
}

Note:This is the code to the actual player movie clip.

By the way, I didn't copy and paste. :P
Thanks in advance!


All times are Eastern Standard Time (GMT -5) | Current Time: 09:51 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!