Be a Supporter!

'A' button problem.

  • 347 Views
  • 9 Replies
New Topic Respond to this Topic
kawaiiminda
kawaiiminda
  • Member since: Oct. 19, 2008
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
'A' button problem. 2010-01-07 01:13:42 Reply

hey guys im trying to make an Rpg battle but im having this probelm, when i press the 'A' button it plays the movieclip continusly. like as though it's ment to make a character move EX: left and right like as though the button is ment to be held not pressed . i don't want this. I just want to simply press the button without having to worry about it play the movieclip constantly. and im no wizz on actionscript so
.-.-""" i was also wondering if i could get some help with the 'A' button being able to get pressed more than once. so i woun't have to worry about some glitches like my character disapearing randomly......sorry for the trouble guys.=(

PowerSource
PowerSource
  • Member since: Jun. 20, 2008
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to 'A' button problem. 2010-01-07 04:22:34 Reply

At 1/7/10 01:13 AM, kawaiiminda wrote: hey guys im trying to make an Rpg battle but im having this probelm, when i press the 'A' button it plays the movieclip continusly. like as though it's ment to make a character move EX: left and right like as though the button is ment to be held not pressed . i don't want this. I just want to simply press the button without having to worry about it play the movieclip constantly. and im no wizz on actionscript so
.-.-""" i was also wondering if i could get some help with the 'A' button being able to get pressed more than once. so i woun't have to worry about some glitches like my character disapearing randomly......sorry for the trouble guys.=(

i have not really any idea of what you are talking about, but i'll try.

if(Aisdownorwhatever){
guy.play();
}else{
guy.stop();
}

that's my best try at a solution.

dragonjet
dragonjet
  • Member since: Dec. 2, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to 'A' button problem. 2010-01-07 08:35:14 Reply

alright, here is a pseudocode

if ( A is pressed ) {
        if ( moviclip._currentframe == 1 ) {
                   moviclip.play();
        }
}
antonjb
antonjb
  • Member since: Jan. 4, 2010
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to 'A' button problem. 2010-01-07 09:10:29 Reply

Are you working in AS2 or AS3?

kawaiiminda
kawaiiminda
  • Member since: Oct. 19, 2008
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to 'A' button problem. 2010-01-07 18:19:34 Reply

im working on as2

oh sorry i forgot to put the code that i used.

Code:

onClipEvent(enterFrame){
if(Key.isDown(65)){// 66 is the letter "A"
_root.ProtomanBAT.gotoAndPlay(2);
this.gotoAndStop(1);

}
}

kawaiiminda
kawaiiminda
  • Member since: Oct. 19, 2008
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to 'A' button problem. 2010-01-07 18:21:24 Reply

opps where it say 66 it's supose to be 65 sorry for the typo.

UberCream
UberCream
  • Member since: Nov. 19, 2005
  • Offline.
Forum Stats
Member
Level 20
Animator
Response to 'A' button problem. 2010-01-07 18:26:05 Reply

I believe THIS site maybe helpful.


"I'm in love with UberCream." - Max Gilardi.

antonjb
antonjb
  • Member since: Jan. 4, 2010
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to 'A' button problem. 2010-01-07 19:08:38 Reply

At 1/7/10 06:19 PM, kawaiiminda wrote: Code:

onClipEvent(enterFrame){
if(Key.isDown(65)){// 66 is the letter "A"
_root.ProtomanBAT.gotoAndPlay(2);
this.gotoAndStop(1);

}
}

if you don't want it to play constantly can't you just say gotoAndStop(2);

Also it could be better to use a listener for your key press events.

var oKeyListener:Object = {};

oKeyListener.onKeyDown = function():Void
{
	var nKey:Number = Key.getCode();
    
	switch (nKey)
	{
		case 65:
			trace("A");
		break;
	}
};

Key.addListener(oKeyListener);
kawaiiminda
kawaiiminda
  • Member since: Oct. 19, 2008
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to 'A' button problem. 2010-01-07 19:20:08 Reply

thanks, but here's a link to my video so you can get a better understand. sorry im not that great in explaining things.
MegamanRpg
for some odd reason if you hold the A button it plays all of protomans frames.
i don't want that.
if your wondering Protoman is one MovieClip. even the enemy select thingy....same with the Boss.

this is what i did. the first time you press 'A'. the red polygon will come which is your enemy select thing.....

and the second time you press A protoman Attacks and the enemy select thing goes away.

however it doesn't seem to work out correctly. because if you hold the 'A' button it plays all of Protomans frames(remember he's one moiveclip). im trying to make the button avaliable only for a press, not a hold.
EX: while your typing you don't hold the letter do you? you press it. "L" because if you do hold the letter on your key board you get this "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL" sorry like i said im not great in explaining things but i hope it helps. thanks!

kawaiiminda
kawaiiminda
  • Member since: Oct. 19, 2008
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to 'A' button problem. 2010-01-07 20:18:08 Reply

thanks for the code it seems to be funtioning lot more correctly now.
but i'll see what i can do about the minor glitches. this Rpg is imcompete by the way for those who seen the litte flash preview. thanks so much with the help. i ask a little more if i having anymore troubles.