PDA

View Full Version : platform error



Ravmaster
February 7th, 2006, 12:57 PM
it doesnt come up with an error.... but it is one


onClipEvent (load) {
gravity = 10;
scale = _xscale;
walkSpeed = 0;
maxjump = 6;
}
onClipEvent (enterFrame) {
if (air == true) {
_y += gravity;
state = 3;
}
if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
_x -= walkSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {
_x += walkSpeed;
_xscale = scale;
}
if (_root.platforms.hitTest(_x, _y, true)) {
air = false;
_y -= gravity;
} else {
air = true;
}
if (Key.isDown(Key.UP) && jump == true) {
_y -= jumpSpeed;
}
if (air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.UP)) {
jumpcount += 1;
}
if (jumpcount>maxjump && jumpSpeed>-2) {
jumpSpeed -= 2;
}
if (air == false && !Key.isDown(Key.LEFT) && !Key.isDown(65) && _currentframe<4 or air == false && !Key.isDown(Key.RIGHT) && !Key.isDown(65) && _currentframe<4) {
state = 1;
}
if (Key.isDown(Key.LEFT) && air == false && !Key.isDown(65) && _currentframe<4 or Key.isDown(Key.RIGHT) && air == false && !Key.isDown(65) && _currentframe<4) {
state = 2;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}
onClipEvent (enterFrame) {
if (air == true) {
if (Key.isDown(88)) {
gotoAndStop(6);
}
}
else {
if(Key.isDown(88)) {
gotoAndStop(4)
}
}
}


near the end were


onClipEvent (enterFrame) {
if (air == true) {
if (Key.isDown(88)) {
gotoAndStop(6);
}
}
else {
if(Key.isDown(88)) {
gotoAndStop(4)
}
}
}

that is it keeps messing up.... as in when the key is press in the air.... then it just stops at the frame and doesnt play the animation....
and if it is pressed on the ground it plays through the whole hero movie clip... please help!!

thnx in advance... il get my .fla soon cant find a good host....

bombsledder
February 7th, 2006, 03:03 PM
its not a code error its programmer error



onClipEvent (enterFrame) {
if (air == true) {
if (Key.isDown(88)) {
gotoAndPlay(6);
}
}
else {
if(Key.isDown(88)) {
gotoAndPlay(4)
}
}
}


you forgot to use the gotoAndPlay() Method

Ravmaster
February 8th, 2006, 01:20 PM
no i have 6 frames... each frame with a different mc on it i want it to stop @ thats mc and play thru

nathan99
February 8th, 2006, 03:35 PM
For ur issue, i didnt look into it, but, ur code has some unncecessary stuff in it

onClipEvent (load) {
gravity = 10;
scale = _xscale;
walkSpeed = 0;
maxjump = 6;
}
onClipEvent (enterFrame) {
if (air) {
_y += gravity;
state = 3;
}
if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
_x -= walkSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {
_x += walkSpeed;
_xscale = scale;
}
if (_root.platforms.hitTest(_x, _y, true)) {
air = false;
_y -= gravity;
} else {
air = true;
}
if (Key.isDown(Key.UP) && jump) {
_y -= jumpSpeed;
}
if (air) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.UP)) {
jumpcount += 1;
}
if (jumpcount>maxjump && jumpSpeed>-2) {
jumpSpeed -= 2;
}
if ((!air && !Key.isDown(Key.LEFT) && !Key.isDown(65) && _currentframe<4) || (!air && !Key.isDown(Key.RIGHT) && !Key.isDown(65) && _currentframe<4)) {
state = 1;
}
if ((Key.isDown(Key.LEFT) && !air && !Key.isDown(65) && _currentframe<4) || (Key.isDown(Key.RIGHT) && !air && !Key.isDown(65) && _currentframe<4)) {
state = 2;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
if (air) {
if (Key.isDown(88)) {
gotoAndStop(6);
}
} else {
if(Key.isDown(88)) {
gotoAndStop(4)
}
}
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}

Nich
February 22nd, 2006, 08:38 PM
I think I see the problem... The event is happening every time you enter the frame, so every frame, if air == true , and the key is down, then it goes to that frame. No animation is played because it is constantly going to that frame over and over. You need to set a counter that doesn't update the frame until a certain amount of frames have passed. (equal to the length of the animation you want played)

Hope that made sense...

GPP
February 22nd, 2006, 08:49 PM
www.filefactory.com

Up to 500 MB.... if you want to post your fla :)