Play free games online!


Go Back   The Game Homepage Forums > Development > Flash Development

Reply
 
LinkBack Thread Tools Display Modes
  #11  
Old 07-02-2008, 04:59 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 70.21% Better than 70.21% Better than 70.21%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,757
Bigmutha is a jewel in the roughBigmutha is a jewel in the rough
Send a message via AIM to Bigmutha Send a message via MSN to Bigmutha
Default

Quote:
Originally Posted by Gaz View Post
Looks like the problem is that if you never release an arrow button idle never becomes true so it won't get as far as the gotoAndPlay commands.

Here's my solution, it works similar to noobjams but is probably a bit easier to follow:

Code:
onClipEvent (load) {
 idle = true;
}
 
onClipEvent (enterFrame) {
 
  if ((Key.isDown(Key.LEFT) && Key.isDown(Key.RIGHT)) || (!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT))) {
    // If both keys are up or down he is standing 
    idle = true; gotoAndPlay("standing");
 
  } else if (Key.isDown(Key.LEFT) && idle == true) {
    // Otherwise if the left key is down run left
    gotoAndPlay("runningleft");
    idle = false;
 
  } else if (Key.isDown(Key.RIGHT) && idle == true) {
    // Otherwise if the right key is down run right
    gotoAndPlay("runningright");
    idle = false;
  }
 
}
I got rid of the nested if statements too
YAY! Thanks Gaz/noobjam. I could actually understand Gaz's though.

I like how someone tagged the thread with "as2". Funny stuff.
__________________
Reply With Quote
  #12  
Old 07-02-2008, 06:16 PM
mesges's Avatar
Gamer
Power Drill
Better than 21.95% Better than 21.95% Better than 21.95%
 

Join Date: Aug 2007
Location: Surrey, England, look at an atlas if u dont know where that is (ys an ATLAS for all u americans...)
Posts: 1,752
mesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enough
Default

In response to noobjam, what does 'bitwise' mean? Ive never found out...

And I HATE the stupid, obfuscated one-line wonder techniques. You do know that an important part of programming is allowing other people to be able to read your code? At the least you should do it when giving help!!!

Admittedly, I still sometimes slip towards forgetting to press 'Enter', so I have to 'Translate' it before showing it to anyone else xD
__________________

FISHIE!!!

<>< ><> <>< ><> <>< ><><>< ><> <>< ><> <><
Reply With Quote
  #13  
Old 07-02-2008, 06:34 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 70.21% Better than 70.21% Better than 70.21%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,757
Bigmutha is a jewel in the roughBigmutha is a jewel in the rough
Send a message via AIM to Bigmutha Send a message via MSN to Bigmutha
Default

Awww mesges. You covered up my other thread I need help with.
Go post in it, so that Gaz/noobjam can see it and help me.

You seem to know AS, why don't you try helping too.
__________________
Reply With Quote
  #14  
Old 07-02-2008, 06:38 PM
mesges's Avatar
Gamer
Power Drill
Better than 21.95% Better than 21.95% Better than 21.95%
 

Join Date: Aug 2007
Location: Surrey, England, look at an atlas if u dont know where that is (ys an ATLAS for all u americans...)
Posts: 1,752
mesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enoughmesges will become famous soon enough
Default

Gave up on AS ages ago, too hard to find a decent tutorial, and you have to pay for flash (even though I dont, It makes fewer tutorials...

As for bitwise, I know it from C++, and it seems to have much of the same syntax.
__________________

FISHIE!!!

<>< ><> <>< ><> <>< ><><>< ><> <>< ><> <><
Reply With Quote
  #15  
Old 07-02-2008, 08:50 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 70.21% Better than 70.21% Better than 70.21%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,757
Bigmutha is a jewel in the roughBigmutha is a jewel in the rough
Send a message via AIM to Bigmutha Send a message via MSN to Bigmutha
Default

*Whistles* Over here Gaz!
Spawning MC's on a Circle
__________________
Reply With Quote
  #16  
Old 07-03-2008, 12:52 AM
nàme's Avatar
Gamer
RoboRaptor
Better than 87.70% Better than 87.70% Better than 87.70%
 

Join Date: Aug 2007
Location: edmonton
Posts: 3,332
nàme is on a distinguished roadnàme is on a distinguished road
Default

*backs away from this thread forever*
__________________
(\ (\
( ^_^)
(_(")(")
This is Bunny. Copy and paste bunny into your sig to help him gain world domination...
(\/)
(-_-)
(")(")
This is Bunny's friend. Copy and paste Bunny's friend for back-up...
/\_/\
( .. )
(")(")
This is robot-bunny. He will dominate everything who stands in Bunny's path...
|\_/| _______.
|^^|| ' |
|'') |'')
Bunny's bodyguard carries a gun everywhere he goes...
(\__/)
( O.o)
(> < ) Its a demented bunny...
(\(\ ~~ be a bunny ~~
(='.')~~ make war ~~
o(_")")~~ not luv ~~
Reply With Quote
Sponsored Links
Reply

Tags
as2, flash, walking

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:06 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2007, Crawlability, Inc.

Ad Management by RedTyger