Artifacts when moving object with the help of the arrow keys.

Hi all

hope this is the right place to post this question.

I want to write simple arkanoid game in Flash (AC3). I managed to write code that moves my paddle with the arrow keys. The code looks like this:

function OnNewFrame(event:Event):void
{ 
    if (input.IsLeftHeld)
    {
        if (paddle.x > 0)
        {
            paddle.x -= 10;
        }
    }
    else
    if (input.IsRightHeld)
    {
        if (paddle.x < stage.stageWidth - paddle.width)
        {
            paddle.x += 10;
        }
    }
}

It works, but the result is ugly. The animation is not smooth, there are moments when the paddle stops for a moment. Also when the speed of translation is high (this is 10) you can see that paddle flashes at the ends, it resembles the unique problem of buffering. You can see both of these effects here: http://www.flash-game-design.com/flash-tutorials/movOb.html , identified flicker is less visible due to the amount of small translation.

How to solve this problem? How can I enable double buffering (or maybe it is enabled by default)?  Any help will be appreciated.

PS Sorry for the bad English

Hello! I think you went backwards... First - in order to achieve the best visual transitions - you will not use travel speed at all. Second - you must pay attention to the establishment of the frame rate of the Flash document. Vivid games usually run at 60 frames per second. So I made a sample for you. Try it, it: http://cdn.dmldevelopment.com/plugins/tests/paddle/paddle.html . You can use arrow keys plus a key space to see how smooth the transition is. And you can download the source code here: https://rapidshare.com/files/3779443821/paddle.zip . Please let me know if I helped you. See you soon!

Tags: Adobe Animate

Similar Questions

  • I can move me is no longer an object with the arrow keys

    Sure I have inadvertently option disabled to select an object and move it with the arrow keys on my keyboard, but can understand what I did--or how to enable this option again.

    Illustrator CC

    iMAC 27 "end 2013

    10.9.5 OS

    Found the answer in another thread. Somehow my keyboard Increments area was changed to a small extent (. 00002 ") that I could not see the object move, nor does the X & coordinated change. I didn't change this preference to. 00002 ", but it is now fixed.

  • Moving objects selected with the arrow keys

    I often position objects by selecting them and moving them with the arrow keys. However, increasing the default value is often too large. I know the Illustrator has a setting in preferences to change the increment. Is there a similar parameter in FreeHand? I have not found one. Thanks for any information.

    > I often position objects by selecting them and moving them with the arrow keys.
    > However, the default increment is often too big. I know that Illustrator
    > has a setting in the preferences to change the increment. Is there a
    > similar parameter in FreeHand? I have not found one. Thanks for any information.

    Main menu: file > Document settings > remote cursor

    Oddly enough named but more Freehand this other feature before many started programs "pushing".

    If the parameter "will not stick' open the default page (see Preferences / Document /"New Document Template") make the frame and save, as for example MyDefaults.ft11 preference.

    Jukka

  • Objects moving with the arrow keys?

    Is there a way to "push" the elements in the Viewer (such as text, pictures) with the arrow keys or the keys on the keyboard?

    When you say "Viewer", you tell the program monitor, or somewhere else?

    Hunt

  • I see two windows 'readers' when I boot with the Option key

    I had to reinstall Windows 10 (with BootCamp).  Now, I see two windows 'readers', when I boot with the Option key button.

    How can I remove a?

    Start two of them in the same installation of Windows?

  • Using Firefox 30 0n win 7 system. When I'm on a web page and try to scroll right scroll with the arrow keys, the page jumps to the bottom of the page is chec

    The application databases

    Name: Firefox
    Version: 30.0
    User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; RV:30.0) Gecko/20100101 Firefox/30.0

    Reports of incidents for the last 3 days

    All Crash reports

    Extensions

    Name: McAfee Security Scan more
    Version: 1.0
    Enabled: false
    ID: {e4f94d1e-2f53-401e-8885-681602c0ddd8}

    Name: McAfee SiteAdvisor
    Version: 3.7.0
    Enabled: false
    ID: {4ED1F68A-5463-4931-9384-8FFF5ED91D92}

    Important change preferences

    Accessibility.browsewithcaret: true
    Browser.cache.Disk.Capacity: 358400
    Browser.cache.Disk.smart_size_cached_value: 358400
    Browser.cache.Disk.smart_size.first_run: false
    Browser.cache.Disk.smart_size.use_old_max: false
    browser.places.smartBookmarksVersion: 7
    browser.sessionstore.upgradeBackup.latestBuildID: 20140605174243
    Browser.Startup.homepage_override.buildid: 20140605174243
    Browser.Startup.homepage_override.mstone: 30.0
    dom.mozApps.used: true
    extensions.lastAppVersion: 30.0
    network.cookie.prefsMigrated: true
    places.database.lastMaintenance: 1404084666
    places. History.expiration.transient_current_max_pages: 100530
    plugin.disable_full_page_plugin_for_types: application/pdf
    plugin.importedState: true
    Print.printer_HP_Photosmart_6510_series.print_bgcolor: false
    Print.printer_HP_Photosmart_6510_series.print_bgimages: false
    Print.printer_HP_Photosmart_6510_series.print_colorspace:
    Print.printer_HP_Photosmart_6510_series.print_command:
    Print.printer_HP_Photosmart_6510_series.print_downloadfonts: false
    Print.printer_HP_Photosmart_6510_series.print_duplex: 1515870810
    Print.printer_HP_Photosmart_6510_series.print_edge_bottom: 0
    Print.printer_HP_Photosmart_6510_series.print_edge_left: 0
    Print.printer_HP_Photosmart_6510_series.print_edge_right: 0
    Print.printer_HP_Photosmart_6510_series.print_edge_top: 0
    Print.printer_HP_Photosmart_6510_series.print_evenpages: true
    Print.printer_HP_Photosmart_6510_series.print_footercenter:
    Print.printer_HP_Photosmart_6510_series.print_footerleft: & PT
    Print.printer_HP_Photosmart_6510_series.print_footerright: & D
    Print.printer_HP_Photosmart_6510_series.print_headercenter:
    Print.printer_HP_Photosmart_6510_series.print_headerleft: & T
    Print.printer_HP_Photosmart_6510_series.print_headerright: & U
    Print.printer_HP_Photosmart_6510_series.print_in_color: true
    Print.printer_HP_Photosmart_6510_series.print_margin_bottom: 0.5
    Print.printer_HP_Photosmart_6510_series.print_margin_left: 0.5
    Print.printer_HP_Photosmart_6510_series.print_margin_right: 0.5
    Print.printer_HP_Photosmart_6510_series.print_margin_top: 0.5
    Print.printer_HP_Photosmart_6510_series.print_oddpages: true
    Print.printer_HP_Photosmart_6510_series.print_orientation: 0
    Print.printer_HP_Photosmart_6510_series.print_page_delay: 50
    Print.printer_HP_Photosmart_6510_series.print_paper_data: 1
    Print.printer_HP_Photosmart_6510_series.print_paper_height: 11 h 00
    Print.printer_HP_Photosmart_6510_series.print_paper_name:
    Print.printer_HP_Photosmart_6510_series.print_paper_size_type: 0
    Print.printer_HP_Photosmart_6510_series.print_paper_size_unit: 0
    Print.printer_HP_Photosmart_6510_series.print_paper_width: 8.50
    Print.printer_HP_Photosmart_6510_series.print_plex_name:
    Print.printer_HP_Photosmart_6510_series.print_resolution: 1515870810
    Print.printer_HP_Photosmart_6510_series.print_resolution_name:
    Print.printer_HP_Photosmart_6510_series.print_reversed: false
    Print.printer_HP_Photosmart_6510_series.print_scaling: 1.00
    Print.printer_HP_Photosmart_6510_series.print_shrink_to_fit: true
    Print.printer_HP_Photosmart_6510_series.print_to_file: false
    Print.printer_HP_Photosmart_6510_series.print_unwriteable_margin_bottom: 0
    Print.printer_HP_Photosmart_6510_series.print_unwriteable_margin_left: 0
    Print.printer_HP_Photosmart_6510_series.print_unwriteable_margin_right: 0
    Print.printer_HP_Photosmart_6510_series.print_unwriteable_margin_top: 0
    privacy.sanitize.migrateFx3Prefs: true
    privacy.sanitize.timeSpan: 0
    Storage.vacuum.Last.index: 1
    Storage.vacuum.Last.places.sqlite: 1403633482

    Graphics

    Description of the adapter: ATI Mobility Radeon HD 4200 Series
    Drivers: atiu9p64 aticfx64 aticfx64 atiu9pag aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
    RAM card: 256
    Device ID: 0 x 9712
    Direct2D Enabled: Blocked for your version of the graphics driver. Try to update your driver graphic version 10.6 or newer.
    DirectWrite Enabled: false (6.2.9200.16571)
    Driver date: 15/03/2010
    Driver version: 8.712.2.1000
    GPU #2 Active: false
    GPU accelerated Windows: Direct3D 9 1/1
    Vendor ID: 0 x 1002
    WebGL Renderer: Google Inc. - ANGLE (ATI Mobility Radeon HD 4200 Series Direct3D9Ex vs_3_0 ps_3_0)
    windowLayerManagerRemote: false
    AzureCanvasBackend: skiing
    AzureContentBackend: Cairo
    AzureFallbackCanvasBackend: Cairo
    AzureSkiaAccelerated: 0

    JavaScript

    Incremental GC: true

    Accessibility

    Enabled: false
    Prevent accessibility: 0

    Versions of the library

    NSPR
    The expected minimum version: 4.10.6
    Version: 4.10.6

    NSS
    The expected minimum version: 3.16 base ECC
    Version: 3.16 base ECC

    NSSSMIME
    The expected minimum version: 3.16 base ECC
    Version: 3.16 base ECC

    NSSSSL
    The expected minimum version: 3.16 base ECC
    Version: 3.16 base ECC

    NSSUTIL
    The expected minimum version: 3.16
    Version: 3.16

    This could be linked to the "keyboard navigation" function, which moves the cursor on the page when you scroll with the arrow. Or maybe in this case jumps around things on the page.

    You can enable the use:

    • F7 key
    • "3-bar" menu button (or tools) > Options > advanced > general mini-onglet > uncheck the box 'always use the buttons cursor to navigate through the pages.

    A little luck?

  • Moving an object using the arrow keys

    I think I've changed the default distance to move an object using the arrow keys of 1 Point (1/72 inch). Can you help me change the default or tell me how to set the distance you can move an object such as a text field using the arrow keys. Thank you.

    It is based on your grid interval setting in the drawing AIDS palette. For a grid of 1 point, you would need apart 12/pc (although it says the points of the grid is picas, points 12-pica).

    I find 1 point too fine, I use a grid of 4/pc (3 points) and I have all my subject base around multiples of 3 measurements.

  • How to prevent multiple objects with the same key being stored?

    Hello
    I use of DPL and I want to know if we have any way of preventing multiple objects with the same primary key is stored in the database or not.

    Thank you

    Hello

    Primary keys are unique - there may be multiple objects with the same key. Did you look in the javadoc for the PrimaryIndex and methods put ()?

    -mark

  • CAN´t of the points with the arrow keys

    Trial version CS6.

    I can´t of the objects with the arrow mount points when I chose it with 'Path - select Points.

    If you use the Panel traced to select points, you will need to click on the object (on the Web) after fact selection. Then, you can use the arrow keys.

    The reason for this parasite has something to see 'keyboard' attention on the Panel instead of the object. The developer of the Panel Traces, Aaron Beall, is aware of this problem and decided to release a fix for this, according to this recent thread:

    http://forums.Adobe.com/thread/1017765?TSTART=0

  • How can I move a symbol with the arrow keys in canvas htlm5 CC animate?

    I'm going through a 'Hero' with the arrow keys, but do not know how addEventListener 'allure '.

    Code would be nice...

    As a general rule, if you want to do something in HTML5 Canvas in Animate, and the Code Snippets Panel doesn't have an example of what you want to do, do a Google search for "createjs whatever you want to do." Search for "createjs-keyboard listeners" showed so far include:

    ilike2Flash: keyboard events in EaselJS

    It seems that the keys are trapped by the browser, and so you will have to use the window listeners to see when someone pressed a key. The code example does what you ask for. It is written in HTML, but the Javascript part of the example should work in the Actions of Animate Panel.

  • Problem with the arrow keys in the editor

    Hi, I have problem with the arrow keys in the editor. I don't use arrow in the editor to the bottom and select list (list of table fields, for example). Arrow in the result window or navigator to work normally.
    In the editor, I have problem with SHIFT + left arrow also key.
    Someone at-similar problem? (Developer SQL 1.5.5 with patch)
    Thanks for your reply, Petr

    Could be the old and known problem with accelerators, try:

    Preferences - accelerators - load - default setting

    Hope that helps,
    K.

  • LabVIEW 2009 SP1 crashes when moving large selection with the arrow key

    If I select a lot (10 or 15) diagram components and try to move some distance with the arrow button, I'm often a program crash.  Because a reduced number of components seems to hang after a longer distance traveled, it looks like some sort of buffer overflow error.  I don't see this problem when you use the mouse to move selections.

    I checked to make sure I have the latest version of the video driver for my NVIDIA Quatro FX570.  I also tried to work with no hardware acceleration and no handset, written.  What happens on Windows XP SP3 with all current updates.

    It became so bad that I have to do a save as every fifteen minutes to avoid losing data.

    Why not use my mouse for all movements?  Because it is not as specific and not so easy to limit to only one dimension of the movement.   My hand is not as stable as it once was.

    I'm hoping someone will have a suggestion that will clear up this problem.

    As I have indicated, I had the same problem with 8.5 and just DID a new install of Labview 2009.

    Since it is possible that my three monitors configuration, which of course requires more memory video, may be at the origin of the problem, I am satisfied with workaround by dragging the objects closer to their final destination and then using the arrow keys.

    Three monitors are ideal for the front, block and help/Internet/probe damaged.  When I got to work in the field with a single monitor, I felt severely handicapped.

    You can consider the issue closed.

    Thank you for trying to reproduce the failure.

  • Problem with the arrow keys in some tools

    Then, as most of you know, you can use the arrows on your keyboard to change the radius of rounding of certain tools, add or remove segments of the spiral shape, etc. A tap should adjust your settings of the tool into thin slices. But in my case when I press the arrow key, it makes big changes. The same thing is 'C', 'X', 'F', 'V '. So I can't use these tools properly. Does anyone know how to deal with this problem? Thanks in advance!

    If you use a Wacom tablet, then you are a victim of the Wacom/Illustrator bug. As far as I know there is no solution yet. The only solution is to temporarily use a conventional mouse.

  • direct selection - move the anchor points with the arrow keys of the keyboard

    Hello

    I use Illustrator CC.  I just use the image tracking tool to create a version vector of my company logo.  It worked pretty well, but now I'm just trying to clean it up a bit.  I have a few anchor points that I want to just push upwards or downwards into the smallest possible increment.

    I think it would be easier for me to do using the arrow keys on the keyboard instead of the mouse, but the arrows cause my selected anchor point to jump in too large a distance way.  I checked to make sure that the bearings commented, snap to grid and snap to Point are all extinct.  I don't see anything else to do.

    Can someone tell me which control how the keyboard arrow keys will move an anchor point, and how can I fix this to the smallest possible distance?

    Thanks in advance,
    Paul

    General Prefs, area keyboard Increments. Have something you need.

    Then use Nudge (up, down, left, right arrow).

  • When will it be possible to navigate in the components of small and big day in the calendar with the arrow keys and PgUp/Dwn?

    Because I have difficulty working with the mouse (like many people), would be nice if I can use the keyboard as far as possible when applications on the computer. I often use Alt Tab, Ctrl-Tab, PgUp/Dwn - < item of menu or button-to-do-something thing > etc. The lightning might be easier to use in this regard.

    In my opinion, this way of designing the user interface must be applied as much as possible. And it should not hinder - but supplement - other ways to navigate through the applications, as in the mouse, scroll bars, etc.

    When a developer or more find time to fix it. You can keep an eye on https://bugzilla.mozilla.org/show_bug.cgi?id=472448 and https://bugzilla.mozilla.org/show_bug.cgi?id=431076 for the current state.

Maybe you are looking for

  • FAILURE ID 90C7W-5TC72S-MFGH5A - 60DR 03

    I have had this error coming up... hard Disk1, I can't run the test computerized quotes, self-financing not work.it returns me the defect number above ID... can u help me, what can I do?

  • M30: BIOS password: never put but now ask for a password

    I never put my password BIOS before on my laptop Toshiba Satellite M30. However I changed just turn it on and the phone asks me a password. Does anyone know why this is so? I'm not asking how to hack - but I was wondering what the hell!

  • Re: Satellite P300-1AE - port SATA speed

    Hello I have wonderd what sata port speed is on my laptop for a possible upgrade to an ssd.I know that the chipset is able to use 3 Gbit/S, but I've also read that some company limited the seed to 1.5 Gbps for the extended battery life.Given that dri

  • Help! Mini 210-2000 Home key

    I just got my new 210-2000 HP Mini and I'm trying to figure out how to create a shortcut for the home, end, Page Up, Page Down.  I saw the reference to the use of the fn + combination of arrow, but it does not work. Does anyone know how this is possi

  • Server PowerEdge PE T630 Windows 2012R2 update device driver

    We should install this device driver to update Windows on Dell servers? Hewlett-Packard Development Co, LP. -Other hardware - HP Baseboard Management Controller peripheral IPMI Download size: 1.5 MB You may have to restart your computer for this upda