Login
...or Sign up
Home
Search
Search Code Snippets
Search People
AS3 - Switch and collision
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed); function keyPressed (event:KeyboardEvent):void { switch (event.keyCode) { case Keyboard.RIGHT : blue_mc.x +=5 break; case Keyboard.UP : blue_mc.y -=5 break; case Keyboard.DOWN : blue_mc.y +=5 break; case Keyboard.LEFT : blue_mc.x -=5 break; default : break; } // test collision if(blue_mc.hitTestObject(green_mc)) { green_mc.alpha = 0.5; trace("green circle was hit!"); } else { green_mc.alpha = 1; } }
Score: 0/10
Would you like to comment?
Sign up
for a free account or
sign in
(if you are already a member).
URL:
Embed:
Uploaded on 11/22/2009 1:38:16 PM
by
tpr
Programming Language:
ActionScript
Tags:
collision
loop
switch
Viewed 248 times
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com