Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-28-2009, 06:58 PM   #1
Registered User
Join Date: Feb 2009
Posts: 10
Default [AS2] Key Down Question.

Hello. Im looking to add new weapons to my games. Im not sure how to make it so that it replaces the current bullet movieclip so im making it an ammo type. I would like to make it so that everytime you hit 1,2,3,etc, that it will shoot based on the number you pushed. I noticed that it didnt include any numbers or letters with keydown so i was wondering what the script would be.

if (Key.isDown(Key.(I want this to be 1)) {

if (timer>=5) {
_root.attachMovie("Bullet1","Bullet1"+i,_root.getN extHighestDepth());
_root["Bullet1"+i]._x = Ship._x+3;
_root["Bullet1"+i]._y = Ship._y;
timer = 0;// Restarts the timer at 0.

ajk62089 is offline   Reply With Quote
Old 03-01-2009, 03:34 AM   #2
Senior Member
Join Date: Feb 2008
Posts: 387

You specify the key code for the key....you can find the codes here http://www.asciitable.com/

PS: 32 is space

oh and learn to use arrays properly then you will be able to switch weapons....if you get stuck, ask here!
bluemagica is offline   Reply With Quote
Old 03-01-2009, 11:12 AM   #3
Posts: n/a

Check this out.

  Reply With Quote
Old 03-01-2009, 05:56 PM   #4
Registered User
Join Date: Feb 2009
Posts: 10

Thanks a bunch. I already got it so u can use multiple weapons but i couldnt figure out how to use anything other than enter, shift, alt, etc. I tried using the number corresponding to the key like i used to in visual basic but i set it up wrong. Thanks again =).
ajk62089 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS2] checkbox component question thearc Components 3 11-13-2008 04:34 PM
[AS2] golf game question melnet Gaming and Game Development 0 10-07-2008 03:25 PM
Key Listeners help jdsflash ActionScript 2.0 1 08-07-2007 05:30 PM
Enter key question ssipse ActionScript 2.0 3 05-12-2007 04:29 PM
enter key question timothye Other Flash General Questions 2 04-04-2004 04:34 PM

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

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.