# Keyboard movement quality issue, unwanted blur at movement

**URL:** <https://forum.kirupa.com/t/keyboard-movement-quality-issue-unwanted-blur-at-movement/297540>\
**Category:** Uncategorized\
**Created:** [October 4, 2009, 8:38pm UTC](https://forum.kirupa.com/t/keyboard-movement-quality-issue-unwanted-blur-at-movement/297540 "2009-10-04T20:38:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omgnoseat](https://avatars.discourse-cdn.com/v4/letter/o/5fc32e/32.png) [@omgnoseat](https://forum.kirupa.com/u/omgnoseat)\
**Post date:** [October 4, 2009, 8:38pm UTC](https://forum.kirupa.com/t/keyboard-movement-quality-issue-unwanted-blur-at-movement/297540/1 "2009-10-04T20:38:52Z")

</div>

Hello,

I have a strange problem with keyboard movement on a MC. When using the keyboard to move the MC across the screen, there a slight blur (ecspecially when jumping with the up key). I have no idea whats causing this, the actionscript only contains functions for movement. I’m using the keyobject.as from senocular to be able to animate the MC on movement.

Here is the actionscript i’m using:

```
ActionScript Code:
[LEFT][COLOR=#000000] **var** [/COLOR] [COLOR=#0000FF]Key[/COLOR]:KeyObject = [COLOR=#000000] **new** [/COLOR] KeyObject[COLOR=#000000]([/COLOR][COLOR=#0000FF]stage[/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#000000] **var** [/COLOR] xSpeed:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]8[/COLOR];  
[COLOR=#000000] **var** [/COLOR] ySpeed:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]5[/COLOR];

[COLOR=#000000] **var** [/COLOR] dy:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR];

[COLOR=#000000] **var** [/COLOR] gravity:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]1[/COLOR];

[COLOR=#000000] **var** [/COLOR] canjump:[COLOR=#0000FF]Boolean[/COLOR] = [COLOR=#000000] **false** [/COLOR];

[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#808080]_//addEventListener(Event.ENTER\_FRAME, apply);_[/COLOR]

[COLOR=#000000] **function** [/COLOR] moveCharCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR][COLOR=#000000]{[/COLOR]

```
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]isDown[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]LEFT[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]

    robot.[COLOR=#000080]x[/COLOR]-=xSpeed;
    robot.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]3[/COLOR][COLOR=#000000])[/COLOR];
    robot.[COLOR=#000080]scaleX[/COLOR] = -[COLOR=#000080]1[/COLOR];
    [COLOR=#808080]*//movingLeft = true;*[/COLOR]
    
    [COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]isDown[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]RIGHT[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
        
        [COLOR=#808080]*//movingRight = true;*[/COLOR]
    
    [COLOR=#808080]*//mountains.x -= backgroundSpeed;*[/COLOR]
    robot.[COLOR=#000080]x[/COLOR] += xSpeed;
    [COLOR=#808080]*//robot.scaleX=1;\*[/COLOR]
    robot.[COLOR=#000080]scaleX[/COLOR] = [COLOR=#000080]1[/COLOR];
    robot.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]3[/COLOR][COLOR=#000000])[/COLOR];
    
    
    [COLOR=#000000]}[/COLOR][COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]isDown[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]UP[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
    
    [COLOR=#808080]*//movingUp = true;*[/COLOR]
    [COLOR=#808080]*//robot.y -=ySpeed;*[/COLOR]
    [COLOR=#808080]*//robot.gotoAndStop(3);*[/COLOR]

    
    [COLOR=#000000]}[/COLOR][COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]isDown[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]DOWN[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
        
    [COLOR=#808080]*//movingDown = true; *[/COLOR]
    [COLOR=#808080]*//robot.y +=ySpeed;*[/COLOR]
    [COLOR=#808080]*//robot.gotoAndStop(3);*[/COLOR]
    [COLOR=#808080]*//ySpeed*= accelerate;*[/COLOR]
    
    [COLOR=#000000]}[/COLOR][COLOR=#0000FF]else[/COLOR][COLOR=#000000]{[/COLOR]
        robot.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#808080]*//movingLeft = false;*[/COLOR]
        [COLOR=#808080]*//movingRight = false;*[/COLOR]
        [COLOR=#808080]*//movingUp = false;*[/COLOR]
        [COLOR=#808080]*//movingDown = false;*[/COLOR]
        
    [COLOR=#000000]}[/COLOR]

```

[COLOR=#808080]_/////////////////////BOUNDARIES//////////////////////_[/COLOR]  
[COLOR=#808080]_/////////////////////////////////////////////////////_[/COLOR]

[COLOR=#808080]_//right_[/COLOR]  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]robot.[COLOR=#000080]x[/COLOR] \> [COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]stageWidth[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
robot.[COLOR=#000080]x[/COLOR] = [COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]stageWidth[/COLOR];[COLOR=#000000]}[/COLOR]

[COLOR=#808080]_//left_[/COLOR]

[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]robot.[COLOR=#000080]x[/COLOR] \< [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
robot.[COLOR=#000080]x[/COLOR] = [COLOR=#000080]0[/COLOR];[COLOR=#000000]}[/COLOR]

[COLOR=#808080]_//////////////////////////////GRAVITY///////////////////////////////_[/COLOR]  
[COLOR=#808080]_////////////////////////////////////////////////////////////////////_[/COLOR]

dy+= gravity;

[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]robot.[COLOR=#000080]y[/COLOR] \> [COLOR=#000080]200[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
dy = [COLOR=#000080]0[/COLOR];  
canjump = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#808080]_//if the up key is pressed, and canjump is true_[/COLOR]  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Key[/COLOR].[COLOR=#0000FF]isDown[/COLOR]COLOR=#000000[/COLOR] && canjump[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
dy = -[COLOR=#000080]10[/COLOR];  
canjump = [COLOR=#000000] **false** [/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#808080]_//apply gravity to character_[/COLOR]  
robot.[COLOR=#000080]y[/COLOR] += dy;

[COLOR=#000000]}[/COLOR][COLOR=#808080]\*//end of enter frame \*[/COLOR]

[/LEFT]

I have attached the swf so you can see what I mean.

I hope anyone can explain what could be causing this.  
Thanks in advance
