Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,399 Programmers. There are 1,440 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

if(Key.isDown(38))

 
Reply to this topicStart new topic

if(Key.isDown(38))

alohachow
post 1 May, 2008 - 01:02 AM
Post #1


New D.I.C Head

*
Joined: 30 Mar, 2008
Posts: 5



Hello there,

I'm creating a game right now. It uses arrow keys to move the main character, but as I pressed up it wont go down anymore unless you release the up arrow. I want it to go down after pressing the up arrow "ONCE" only. If you have any ideas please HELP... I'm using Flash 8

Thanks a lot.

This post has been edited by alohachow: 1 May, 2008 - 01:03 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Annihilatedsin
post 4 May, 2008 - 07:08 PM
Post #2


New D.I.C Head

*
Joined: 4 May, 2008
Posts: 2

QUOTE(alohachow @ 1 May, 2008 - 01:02 AM) *

Hello there,

I'm creating a game right now. It uses arrow keys to move the main character, but as I pressed up it wont go down anymore unless you release the up arrow. I want it to go down after pressing the up arrow "ONCE" only. If you have any ideas please HELP... I'm using Flash 8

Thanks a lot.


I hope this helps mate, This is how I code my games. I put all my code in the first frame, the key to getting it to move as long as your arrow key is down you have to add the "onEnterFrame" function. oh btw, this is actionscript 2.0.

CODE

stop();


onEnterFrame = function(){

if(Key.isDown(Key.UP){
_root.MOVIECLIP._y += insert a number here or make a variable that holds a number;

}




This post has been edited by Annihilatedsin: 4 May, 2008 - 07:12 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

alohachow
post 4 May, 2008 - 10:00 PM
Post #3


New D.I.C Head

*
Joined: 30 Mar, 2008
Posts: 5

QUOTE(Annihilatedsin @ 4 May, 2008 - 07:08 PM) *


I hope this helps mate, This is how I code my games. I put all my code in the first frame, the key to getting it to move as long as your arrow key is down you have to add the "onEnterFrame" function. oh btw, this is actionscript 2.0.

CODE

stop();


onEnterFrame = function(){

if(Key.isDown(Key.UP){
_root.MOVIECLIP._y += insert a number here or make a variable that holds a number;

}





Thanks, for the help, but its not what I meant.

What happens is when I press UP arrow my movieclip would jump but the problem is this... it won't go down because I haven't release my UP arrow yet. What I want to happen is I want that my movieclip would jump once I pressed my UP arrow but only "ONCE", whether I release my UP arrow or not it will automatically go down.

You got it???
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/17/08 06:08AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month