Play free games online!


Go Back   The Game Homepage Forums > Development > Flash Development

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

Join Date: Aug 2007
Location: Chico, California
Posts: 1,998
Bigmutha is a jewel in the roughBigmutha 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, 07:16 PM
mesges's Avatar
Gamer
Power Drill
Better than 22.62% Better than 22.62% Better than 22.62%
 

Join Date: Aug 2007
Location: Surrey, England, and no more anti-american stuff...I think Obama wins...
Posts: 2,069
mesges 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
__________________
I guess that since Bush is leaving soon, I'll change my signature...

Quote:
Originally Posted by DaMan113 View Post
I guess my mouse flinched or something.
Quote:
Originally Posted by mysteryMAN View Post
WTF is a 'g'...?
Reply With Quote
  #13  
Old 07-02-2008, 07:34 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 71.26% Better than 71.26% Better than 71.26%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,998
Bigmutha is a jewel in the roughBigmutha 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, 07:38 PM
mesges's Avatar
Gamer
Power Drill
Better than 22.62% Better than 22.62% Better than 22.62%
 

Join Date: Aug 2007
Location: Surrey, England, and no more anti-american stuff...I think Obama wins...
Posts: 2,069
mesges 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.
__________________
I guess that since Bush is leaving soon, I'll change my signature...

Quote:
Originally Posted by DaMan113 View Post
I guess my mouse flinched or something.
Quote:
Originally Posted by mysteryMAN View Post
WTF is a 'g'...?
Reply With Quote
  #15  
Old 07-02-2008, 09:50 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 71.26% Better than 71.26% Better than 71.26%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,998
Bigmutha is a jewel in the roughBigmutha 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, 01:52 AM
nàme's Avatar
Gamer
RoboRaptor
Better than 87.77% Better than 87.77% Better than 87.77%
 

Join Date: Aug 2007
Location: edmonton
Posts: 3,782
nàme will become famous soon enoughnàme will become famous soon enoughnàme will become famous soon enoughnàme will become famous soon enough
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

(\(\ ~ be a bunny ~
(='.')~ make war ~
o(_")")~ not luv ~

http://forums.thegamehomepage.com/everything-else/
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 07:38 PM.


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

Ad Management by RedTyger