Forum Topic: More help with AS...

(177 views • 12 replies)

This topic is 1 page long.

<< < > >>
Sleeping

NoirSahdo

Reply To Post Reply & Quote

Posted at: 8/13/07 06:57 PM

NoirSahdo NEUTRAL LEVEL 02

Sign-Up: 06/10/07

Posts: 22

Nice..im getting more experienced with actionscript...
But i keep getting problems ..And this time, i have another error in my game..
Look at the lines below:

//Stand Animation
onClipEvent (keyUp) {
this.gotoAndStop(1);}

//Right Run Animation
onClipEvent (keyDown) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);}}

//Jump Animation
onClipEvent (enterFrame){
if (jumping == true) {
this.gotoAndStop (3)} else {gotoAndStop(1)}}

Ok, look at the ones in bold: they are contradictory.. or thats were i suppose, the problem is...
When i ask my Jump animation to go to frame 1, its because its not jumping... so it MUST go to frame1....
But my running animation says "When this key is pressed, go frame 2..." anyway, if i press the RIGHT key, it just does stand animation, cause if jump is not "true" then it HAS to go frame 1...get it >_>?

and i cant take out the "else" neither, cause then the jumping animation wouldnt end when my character touches the floor..

-ehem-
So here i am...anybody knows a way to solve this? ...thanks..=_=;


None

sandypaw

Reply To Post Reply & Quote

Posted at: 8/13/07 07:00 PM

sandypaw DARK LEVEL 10

Sign-Up: 06/28/07

Posts: 1,287

tricky code, you could try re-writting it.

=3


None

NoirSahdo

Reply To Post Reply & Quote

Posted at: 8/13/07 07:08 PM

NoirSahdo NEUTRAL LEVEL 02

Sign-Up: 06/10/07

Posts: 22

Lol .hi again. helping you post count again ^_^;
aanyway..
Exactly how rewriting it? thats the only base code i have...
I tought about "if char _x= (insert ground X here) goto frame 1"
But it would have the same results...actually, its pretty hard to say "When you're not jumping, stand there, but if i press right, run"
flash is a complicated being >:(

...
Come to think of it...the answer might be in that exact phrase: "When you're not jumping, stand there, but if i press right, run"


None

sandypaw

Reply To Post Reply & Quote

Posted at: 8/13/07 07:10 PM

sandypaw DARK LEVEL 10

Sign-Up: 06/28/07

Posts: 1,287

Ok, ill try to work mah magic at it =) also noir if your an artist will you look at my latest thread =)

=3


None

NoirSahdo

Reply To Post Reply & Quote

Posted at: 8/13/07 07:15 PM

NoirSahdo NEUTRAL LEVEL 02

Sign-Up: 06/10/07

Posts: 22

Sure thing!
im actually working with sprites (its easier to learn AS that way since you dont have to make all the frame by frame movements) But i wont submit that one...i'll make my own game...LATER D:<

So i'll go lookat the thread ^^


None

sandypaw

Reply To Post Reply & Quote

Posted at: 8/13/07 07:27 PM

sandypaw DARK LEVEL 10

Sign-Up: 06/28/07

Posts: 1,287

Oh, maybe this!

//Right Run Animation
onClipEvent (keyDown) {
if (jumping == false) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop(2);}}

//Jump Animation
onClipEvent (enterFrame){
if (jumping == true) {
this.gotoAndStop (3)} else {gotoAndStop(1)}}

i bet that wont work, im almost sure... but hey

=3


Happy

NoirSahdo

Reply To Post Reply & Quote

Posted at: 8/13/07 07:37 PM

NoirSahdo NEUTRAL LEVEL 02

Sign-Up: 06/10/07

Posts: 22

Damn im busy right now..so ill try the code later, gotta go...But about your thread..was it the tutorial one? i would love to help...but aaah im in a hurry..talk to you in like..an holur >_< till then!


Expressionless

sandypaw

Reply To Post Reply & Quote

Posted at: 8/13/07 07:38 PM

sandypaw DARK LEVEL 10

Sign-Up: 06/28/07

Posts: 1,287

'til then and dont bother it doesnt work anyways... yes its the tutorial one =)

=3


None

Pedochu

Reply To Post Reply & Quote

Posted at: 8/13/07 07:41 PM

Pedochu FAB LEVEL 02

Sign-Up: 05/15/07

Posts: 617

You don't need the keyDown handler to place the Key.isDown inside, instead you should just type

onClipEvent (enterFrame) {
if (Key.isDown(Key.KEYNAME) {
//actions
}
}

Also, animating jumping is very primitive and won't work well, but if you're just experimenting it's fine.

Yes.


None

sandypaw

Reply To Post Reply & Quote

Posted at: 8/13/07 07:50 PM

sandypaw DARK LEVEL 10

Sign-Up: 06/28/07

Posts: 1,287

Lol. hes just confused, so hes expermimenting =)

=3


None

Inkisicion

Reply To Post Reply & Quote

Posted at: 8/13/07 08:48 PM

Inkisicion DARK LEVEL 04

Sign-Up: 08/13/07

Posts: 3

At 8/13/07 07:50 PM, sandypaw wrote: Lol. hes just confused, so hes expermimenting =)

(NoirSahdo Here)
Ok i got MY OWN ACCOUNT NOW D:<
-ehem-
Yea i was just experimenting..couldnt do it tho..
But hey, i could make it move in all directions after all..should not be that sad..XD
Anyway, Thanks for you help guys.


None

Joelasticot

Reply To Post Reply & Quote

Posted at: 8/13/07 10:21 PM

Joelasticot EVIL LEVEL 34

Sign-Up: 02/14/03

Posts: 825

Not sure if you still need help with this but anyway :

You can put the whole thing in an enterFrame handler, and use else's to set the frame :

onClipEvent (enterFrame){
if (Key.isDown(Key.RIGHT)) {
gotoAndStop(2);
}else{
if(jumping){
gotoAndStop(3);
}else{
gotoAndStop(1);
}
}
}

So basically this script asks :

Holding "right" key?
yes => goto frame 2
no => Jumping = true?
yes => goto frame 3
no => goto frame 1

s=0;p=0;onEnterFrame=function(){
s+=(25-p)/20;p+=Math.ceil(s);o="";
for(i=0;i<p;i++){o+=" ";};trace(o+"joelasticot");}


None

Inkisicion

Reply To Post Reply & Quote

Posted at: 8/13/07 10:31 PM

Inkisicion DARK LEVEL 04

Sign-Up: 08/13/07

Posts: 3

At 8/13/07 10:21 PM, Joelasticot wrote: onClipEvent (enterFrame){
if (Key.isDown(Key.RIGHT)) {
gotoAndStop(2);
}else{
if(jumping){
gotoAndStop(3);
}else{
gotoAndStop(1);
}
}
}

That..actually wored O.o..
But it is a bit tricky indeed..thanks though!


All times are Eastern Standard Time (GMT -5) | Current Time: 12:42 AM

<< 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!