dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Disabling Keys in game

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Posts
    2

    Disabling Keys in game

    is there a code to disable keys when a key is down?

    for example if the character is crouching(control key) or planting a bomb he should not be able to jump or run.

    if (Key.isDown(Key.CONTROL)) {

    //what do i need to place here to disable keys A, D and Space?

    }

    i am using flash 8.
    Last edited by fearclowns; 08-15-2007 at 03:43 PM. Reason: forgot something

  2. #2
    Junior Member
    Join Date
    Jan 2007
    Posts
    2
    i dont mean to double post but this problem has been solved which i am an idiot for not thinking of it sooner.

    Code:
    if (Key.isDown(Key.CONTROL)) {
    this.hero.gotoAndStop(40);
    	
                 jumping = -1;
    	xspeed = 0;
    		}
    although it does not disable the keys it prevents the player from jumping or moving left or right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center