Bad effect when draw object moving fast

Hi, i have a shooter game where a gun can shoot a bullet.
This bullet run fast so i move it whit X+=dx (dx is distance in pixel)
When the bullet run too fast i ahve a bad effect, ot smootly.
How i can resolve?
Now my code is frame based i think, i use this:
delay =30;
Timer timer=new Timer(delay, new ActionListener(){
          public void actionPerformed(ActionEvent e){
                    processBulletPosition();
                    timer.setDelay(delay-delayed);
public void processBulletPosition(){
         bullet.process(new 2DVector(10,0)); //2DVector is simple object contain dx and dy increment.
         repaint();
//im use JPanel to paint, not canvas
protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          Graphics2D g2=(Graphics2D)g;
                nanoTime=System.nanoTime();
                bullet.draw(g2);
                delayed=(System.nanoTime()-nanoTime)*1E-6; //make delayed in millisec
}bullet proces is like this:
public void process(2DVector vect){
          int dx=vect.dx;
          int dy=vect.dy;
          x+=dx;
          y+=dy;
}Animation is very smooty, but when a bullet or an other object run too fast and dx increment is too many pixel the effect is very bad, and not smooty.
I think i have same fps becouse i decrement delay time of a delayed time...
Can you help me?
Message was edited by:
blow

One problem is that I'm not sure how accurate Timer is.
A standard approach in this sort of animation is to measure the time since the last redraw and move each component based on the time difference, rather than trying to keep the redraws an exact time apart and moving the components fixed distances.
The distance/time approach reduces the effect of pauses in your rendering code caused by outside influences such as the garbage collector and other game logic such as spawning controllers etc. It won't eliminate pauses but it makes them much less noticable.

Similar Messages

  • Why can't I click on the movie clips when they are moving fast?

    I am making a game where insects in an array fall down from above the screen. The user clicks on these insects to increase his/her score. When the score reaches specific points, the speed increases. When the speed increases, it gets harder to click on these movieclip insects. There is one particular insect where you can't click on and destroy at all when the speed becomes fast. This is the code inside this particular insect. Note that all insects have the same codes in them, but this insect in particular is very hard to click. This insect also has animation in it; I tried making a transparent box around to make the click easier, but it's still not working right.
    import flash.events.MouseEvent;
        import flash.display.MovieClip;
        import fl.motion.Animator;
        import flash.events.*;
        var MainTimeLine = MovieClip(root);
        this.addEventListener(MouseEvent.CLICK, kill3);
        this.dead = false;
        function kill3(e:MouseEvent):void
            this.dead=true;
            mouseChildren=false
            gotoAndPlay(31);
            this.removeEventListener(MouseEvent.CLICK, kill3);
            flash.utils.setTimeout(removeSelf2,2000);
        function removeSelf2():void
            this.parent.removeChild(this);

    there's nothing about a movieclip's speed that would stop it from being clickable.
    your transparent box, should have its visibility property true and alpha=0.

  • I see a line when an object moves fast

    Ok, I shoot a Video with My CANON XHA1S AT: 1440 X 1080 30 fps, with the speed of 60. I created a new project as you can see in Capture Shot.
    I don't know why, But I suddenly see a shakey - line when a hand or any object moves close to the camera. Inside my Timeline I Slowed Motion few Tracks to 32%, the rest is at normal speed, When I check the speed for other Tracks it shows 99.9 %.
    Any answer please
    Thanks
    Simon

    Try rendering a small part (and exporting it) of your timeline and preview it. Is the line still there?
    My experience now is that with the hacked Mercury, the preview is not always top notch but rendering is.
    Are you using interlaced video (you seem to be)? If yes, and you are slowing down your footage the shutter speed you used will make a huge difference in your slows. Usually you want it to be double what you normally use. 60 would be the bare minimum. 250 would be great.
    On my XH A1 (not your model) 120 works fine (increasing it to 250 would mean I have lots of light, like outdoors for example). BTW, try the 60i mode. It has *double* the frames, which is great for slows.

  • Drawing object looses roundness when enlarged.

    Hi all,
    in my movie I have a round drawing object, which i wish to view enlarged (about 2000% of original size) . while editing it looks fine and round but after publishing all theroundness is lost and instead i get visible angles.
    i attach 2 images to visualize, one from the editing stage and the other after publishing.
    is there any way i can get around that strange effect? i created the image from some text i "broke apart" to a drawing object.
    thanks.

    Hey.
    thank for your help again.
    i am not using Bitmap text actually and my JPEG publish quality is set to BEST.
    actually, this even becomes more weird!!
    I tried copying just that specific draw element into a fresh flash movie. a new file. 
    I enlarged the draw element and published the movie-  it came out very round and smooth.
    then, I converted the draw element to a movieclip and applied a simple tween animation to "blow it up" (like i need to have in my original project).
    Published again and there you go! rigidness is back!
    so i guess its either converting to movie clip or the tween animation that does it. but why?
    i havent got a clue anymore...

  • Mouse moves farther when moved faster...  really annoying

    This is really annoying me and I can't believe there is no setting for this.
    All there is is a setting for mouse speed.
    When drawing in photoshop or things like that, if you're trying to draw fast and accurate you can't. Because when you move faster, you're going different lengths then when you move slower. In windows it's all the same, if I move 3 inches going slow I go the same distance as going fast, but not on mac...
    Is there a way to solve this?... You would think they would do something about this.

    Are you using an external USB mouse? If so try downloading the shareware driver USB Overdrive and installing it in place of any third-party mouse software you are presently using. It will give you much greater control over scrolling and tracking speed.
    If you are using the computer's trackpad then you might try installing SideTrack. It also provides more control over tracking and scrolling.
    You will find both at www.versiontracker.com or www.macupdate.com.

  • Why do I keep getting this message when I try to go back to previous page? "object moved to here"

    This is so annoying. I use ancestry.com a lot and after I look at a census or a person on ancestry.com, I try to use the back arrow to go back to the page I started on and the screen goes white and it says "object moved to here." The "here" is a link, but it doesn't work to get me back to the page I want. I have to use the back arrow several times and sometimes it works and sometimes it doesn't, then I have to start ancestry all over again. This is so annoying!

    This is likely an issue with the site and you'll have to contact them and ask them to fix it. But a link to a public page where this happens and lets us reproduce the problem might be helpful.

  • Flash animation bad quality when tweened

    hello to all!
    a)im getting very bad results when i tween objects in flash,ive done the designs(clog wheels)in photoshop and added some fx to them,i save them as a png file and import them into flash,when static all is good,but once they start rotating(motion tweened as a movie clip) making the wheels go around they just look terrible.is it natural for the desing to loose in quality since its moving?or is there smthing that i can do to fix it?
    b)when i motion tween an object there is a start keyframe and an ending keyframe once the cursor gets to the ending keyframe there isnt a smooth cycle it seems like the motion does an instant flash at the end,id like for the motion to seem like the wheel is spining like a normal wheel would do.
    any help woudl be appreciated.
    best regards.

    hey!!!
    thanks alot for your answer,i ticked on the smoothing box,and also customed the bitmap to 100%quality and it does sure look better.
    thanks 1000 for your help.
    best regards.

  • Does anyone experienced bad quality when burning a DVD?

    Does anyone experienced bad quality when burning a DVD?
    Using OS 10.6.8 and Magiv Video in iDVD, I am having a hard time creating a decent DVD. The videos per se are fine, but the intro menu and menu text and images are extremely poor quality and hard to read. What is going on?

    Hi my notes on this - might be of help
    DVD quality
    1. iDVD 08, 09 & 11 has three levels of qualities. (version 7.0.1, 7,0.4 & 7.1.1)
    iDVD 6 has the two last ones
    • Professional Quality
    (movies + menus up to 120 min.) - BEST (but not always for short movies e.g. up to 45 minutes in total)
    • Best Performances
    (movies + menus  less than 60 min.) - High quality on final DVD (Can be best for short movies)
    • High Quality (in iDVD08 or 09) / Best Quality (in iDVD6)
    (movies + menus up to 120 min.) - slightly lower quality than above
    About double on DL DVDs.
    2. Video from
    • FCE/P - Export out as full quality QuickTime.mov (not self-containing, no conversion)
    • iMovie x-6 - Don't use ”Share/Export to iDVD” = destructive even to movie project and especially so
    when the movie includes photos and the Ken Burns effect NOT is used. Instead just drop or import the iMovie movie project icon (with a Star on it) into iDVD theme window.
    • iMovie’08 or 09 or 11 are not meant to go to iDVD. Go via Media Browser and as Large (NOT HD or other resolutiona as result will suffer) or rather use iMovie HD 6 from start.
    3. I use Roxio Toast™ to make an as slow burn as possibly e.g. x4 or x1 (in iDVD’08 or 09  this can also be set)
    This can also be done with Apple’s Disk Utilities application when burning from a DiskImage.
    4. There has to be about or more than 25Gb free space on internal (start-up) hard disk. iDVD can't
    use an external one as scratch disk (if it is not start-up disc). For SD-Video - if HD-material is used I guess that 4 to 5 times more would do.
    5. I use Verbatim ( also recommended by many - Taiyo Yuden DVDs - I can’t get hold of it to test )
    6. I use DVD-R (no +R or +/-RW) - DVD-R play’s on more and older DVD-Players
    7. Keep NTSC to NTSC - or - PAL to PAL when going from iMovie to iDVD
    (I use JES_Deinterlacer to keep frame per sec. same from editing to the Video-DVD result.)
    8. Don’t burn more than three DVDs at a time - but let the laser cool off for a while before next batch.
    iDVD quality also depends on.
    • DVD is a standard in it self. It is Standard Definition Quality = Same as on old CRT-TV sets and can not
    deliver anything better that this.
    HD-DVD was a short-lived standard and it was only a few Toshiba DVD-players that could playback.
    These DVDs could be made in DVD-Studio Pro. But they don’t playback on any other standard DVD-Player.
    Blu-Ray / BD can be coded onto DVDs but limited in time to - about 20-30 minutes and then need
    _ Roxio Toast™ 10 Pro incl. BD-component
    _ BD disks and burner if full length movies are to be stored
    _ BD-Player or PlayStation3 - to be able to playback
    The BD-encoded DVDs can be play-backed IF Mac also have Roxio DVD-player tool. Not on any standard Mac or DVD-player
    Full BD-disks needs a BD-player (in Mac) as they need blue-laser to be read. No red-laser can do this.
    • HOW much free space is there on Your internal (start-up) hard disk. Go for approx. 25Gb.
    less than 5Gb and Your result will most probably not play.
    • How it was recorded - Tripod vs Handheld Camera. A stable picture will give a much higher quality
    • Audio is most often more critical than picture. Bad audio and with dropouts usually results in a non-viewed movie.
    • Use of Video-editor. iMovie’08 or 09 or 11 are not the tools for DVD-production. They discard every second line resulting in a close to VHS-tape quality.
    iMovie 1 to HD6 and FinalCut any version delivers same quality as Camera record in = 100% to iDVD
    • What kind of movie project You drop into it. MPEG4 seems to be a bad choice.
    other strange formats are .avi, .wmv, .flash etc. Convert to streamingDV first
    Also audio formats matters. I use only .aiff or from miniDV tape Camera 16-bit
    strange formats often problematic are .avi, .wmv, audio from iTunes, .mp3 etc
    Convert to .aiff first and use this in movie project
    • What kind of standard - NTSC movie and NTSC DVD or PAL to PAL - no mix.
    (If You need to change to do a NTSC DVD from PAL material let JES_Deinterlacer_3.2.2 do the conversion)
    (Dropping a PAL movie into a NTSC iDVD project
    (US) NTSC DVDs most often are playable in EU
    (EU) PAL DVDs most often needs to be converted to play in US
    UNLESS. They are play-backed by a Mac - then You need not to care
    • What kind of DVDs You are using. I use Verbatim DVD-R (this brand AND no +R or +/-RW)
    • How You encode and burn it. Two settings prior iDVD’08 or 09
    Pro Quality (only in iDVD 08 & 09)
    Best / High Quality (not always - most often not)
    Best / High Performances (most often my choice before Pro Quality)
    1. go to iDVD pref. menu and select tab far right and set burn speed to x1 (less errors = plays better) - only in iDVD 08 & 09
    (x4 by some and may be even better)
    2. Project info. Select Professional Encoding - only in iDVD 08 & 09.
    Region codes.
    iDVD - only burn Region = 0 - meaning - DVDs are playable everywhere
    DVD Studio pro can set Region codes.
    1 = US
    2 = EU
    unclemano wrote
    What it turned out to be was the "quality" settings in iDVD. The total clip time was NOT over 2 hours or 4.7GB, yet iDVD created massive visual artifacts on the "professional quality" setting.
    I switched the settings to "high quality" which solved the problem. According iDVD help, "high quality" determines the best bit rate for the clips you have.
    I have NEVER seen iDVD do this before, especially when I was under the 2 hour and 4.7GB limits.
    For anyone else, there seem to be 2 places in iDVD to set quality settings, the first is under "preferences" and the second under "project info." They do NOT seem to be linked (i.e. if you change one, the other is NOT changed). take care, Mario
    TO GET IT TO WORK SLIGHTLY FASTER
    • Minimum of 25Gb free space on Start-Up hard disk
    • No other programs running in BackGround e.g. Energy-Saver
    • Don’t let HD spin down or be turned off (in Energy-Save)
    • Move hard disks that are not to be used to Trash - To be disconnected/turned off
    • Goto Spotlight and set the rest of them under Integrity (not to be scanned)
    • Set screen-saver to a folder without any photo - then make an active corner (up right for me) and set
    pointer to this - turns on screen saver - to show that it has nothing to show
    Yours Bengt W

  • BADI for ME22n - Component Object List

    Hi ,
    I am working with transaction ME22n. When the item category is L. The material data tab shows a button called Components (Object List). On clicking this button i am taken to another screen which has childeren material items and the related data. I need to capture the values on this screen and compare them with the database values to identify any changes.
    I am working with BADI ME_PROCESS_PO_CUST , method CHECK and OPEN. Please tell me in which method parameter those screen values are stored and i can fetch them.
    Also please suggest me any other approach possible which i can use to capture the screen field values in the component screen.
    Any help would be deeply appreciated.
    Thanks in advance.
    Moderator message : Duplicate post locked. Continue with thread [BADI for ME22n - Component Object List|BADI for ME22n - Component Object List]
    Edited by: Vinod Kumar on Aug 9, 2011 12:25 PM

    Hi,
    Please check this thread
    User exit for component data in ME21n/ME22n
    Thanks

  • After updateing Firefox all my tabs open object moved so I have to diable plugins and run in safe mode which is a real hassel. What can I do to fix this?

    I don't know what else to say other than I have had Firefox for a while and an update came up and so I updated and Firefox has not worked right since then. I open a tab and it comes back Object Move (here) or Object moved temporary or some such crap. I then have to to the Firefox control go to help and and restart with add -on's Disabled I have tried ever other setting listed and nothing changes this problem from happening.

    Hmmm, Norton extensions are broken again in Firefox 4.0.1. It seems that Norton didn't allow for Firefox 4.0 security updates when they updated their Firefox extension for Firefox 4.0. Norton says they'll have a fix in two weeks. A Norton user posted a fix in this forum thread.
    http://community.norton.com/t5/Norton-Internet-Security-Norton/Norton-Toolbar-not-compatible-with-FF-4-0-1/td-p/442788

  • Strange "strobe" effect when doing slow motion

    hi
    after using fcp for a year now, i strangly encountered a problem in a video i need to deliver in 2 days.
    whenever i did a 50% slow motion i get a strange "strobe" effect. when the frame is more or less static then you wont be able to see it but when the camera pans or the object in the frame moves it is very disturbing.
    this is only noticable when viewed on a tv set, not on my display.
    i thought it was in the encoding so i did the whole "export using QT" again, this time making sure its 2 pass VBR 6.8 to 8 mbps. still there.
    i am working on a Pal system without a monitor so i burned the video onto a dvd using dvdsp (as usual) and then played it in a pal dvd player and tv but this strobe thing is still there.
    b.t.w the interlace option on the "export using QT" was set as auto, the same as always.
    i didnt do anything different this time but still i get that problem. what could it be ? all the settings in fcp settings are set to 100% quality and the video is fully rendered.
    i appriciate your comments and help.
    thanx
    nir evron

    hi jim and thanx for the quick reply...
    i used to do my slo-mo in fcp without any problems till today.
    b.t.w - im editing DV PAL.
    i dont have motion so i'm stuck to fcp.
    any suggestions ?
    thanx
    nir

  • When should object casting be used?

    Hi,
    just wondering something. Saw there that returning objects from methods and downcasting the returned object is bad. When should casting be used? I currently have a program that has an object that contains a HashMap as a field. When I try retrieve objects from the HashMap using the relevant key, I have to cast them to what they were originally! Is this bad programming practice or is it the only way to do things?
    Thanks.
    // example of retrieving object from key
    dbDirectory = (String)dbInfo.get("dbDirectory");

    LeWalrus wrote:
    Hi,
    just wondering something. Saw there that returning objects from methods and downcasting the returned object is bad. When should casting be used? I currently have a program that has an object that contains a HashMap as a field. When I try retrieve objects from the HashMap using the relevant key, I have to cast them to what they were originally! Is this bad programming practice or is it the only way to do things?
    Thanks.
    // example of retrieving object from key
    dbDirectory = (String)dbInfo.get("dbDirectory");
    Before generics, this was a perfectly acceptable practice. Generally speaking, you use type-casting when the compiler is unable to ensure the type validity at compile-time, but you know it is correct, so you supply the extra information to the compiler so it knows everything is correct. Sometimes you need to circumvent the strong type-checking part of the language for flexibility, but this is something that should be used very sparingly.
    Now it would be better to use generics so that the compiler will know at compile time that the values in your map are Strings, instead of just Objects.

  • Web service 302 object moved error

    Hi All,
    Last week, IT changed the configuration on our Cisco content
    switch to redirect every page request to https. Everything seems to
    be working properly except for our Web services, which I can't seem
    to consume at all. Here's the error we keep getting:
    Could not perform web service invocation "myFunction"
    because AxisFault faultCode: {
    http://xml.apache.org/axis/}HTTP
    faultSubcode: faultString: (302)Object moved faultActor: faultNode:
    faultDetail: {}string: return code: 302
    Does anyone have any experience serving Web services over a
    content switch that forces a redirect over https? I even get this
    message when trying to consume over https. Our Web servers think
    they're not secured at all, maybe this is the problem? I just
    haven't worked with Web services very much.
    Thanks in advance!
    Cheers,
    -m

    ColdFusion sometimes has some problems connecting to
    webservices using HTTPS.
    Try Daverms's suggestion first. Recreating or refreshing the
    webservice in the CFADMIN might fix your problem. Otherwise, if
    that doesn't work I suggest:
    Try saving the WSDL to a local location and running the
    webservice off the local WSDL. The WSDL should have the location of
    the actual webservice in it (I think the tag is <ServicePort>
    or something like that), so it doesn't really matter where the WSDL
    resides.

  • Copy Multi-Layered Drawing-Object and keep the same Layers

    Good evening
    We often have to clone a Drawing-Object and the clone should use the same Layers. We expected that we can just select the Objects on the related Layers, Drag and keep a key (e.g. Ctrl) and Drop the copy
    An example:
    The original Object has an rectangle and a text on two layers:
    Layer 1: Rectangle (Original)
    Layer 2: Text (Original)
    After cloning, we should have:
    Layer 1: Rectangle (Original) Rectangle (Copy)
    Layer 2: Text (Original) Text (Copy)
    Thanks a lot for all ideas in advance,
    kind regards,
    Thomas

    Thank you for your fast answer!, unfortunately it does not work as expected: after the Copy-Operation I always have more Layers than before. To use my example again:
    The original Object has an rectangle and a text on two layers:
    Layer 1: Rectangle (Original)
    Layer 2: Text (Original)
    Then I select the Rectangle and the Text an copy these Objects.
    I always get:
    Layer 1: Rectangle (Original)
    Layer 2: Text (Original)
    Layer 3: Rectangle (Copy)
    Layer 4: Text (Copy)
    What I expect after copy is:
    Layer 1: Rectangle (Original) Rectangle (Copy)
    Layer 2: Text (Original) Text (Copy)
    Kind regards,
    Thomas

  • Green guidelines (when lining objects up / aligning) missing

    Hi, as title suggests I no longer get the green guidelines which show when the object I am moving is aligned with the bottom/top/middle etc of another object in my document.  Tried a couple of things in 'View' but hasn't seemed to solve the problem - probably being stupid but I haven't got the time to spend ages doing it today!  So, yet again, I am here for your help...
    Thanks as always,
    Mark

    Hi all,
    Thanks for swift response.  Smart Guides are turned 'on', at least according to the little tick next to where it says 'Smart Guides'.
    As an example of what I'm doing, I create a rectangular box and place it anywhere on my page.  I then create another rectangular box (or whatever shape).  When using Illustrator before, I could move the box and some green lines would indicate when my new box was lined up to an edge or the middle of the first box.  It's useful for making sure everything is lined up neatly and accurately, but have no idea where the function has gone.
    Is this description any clearer?
    Thanks again,
    Mark

Maybe you are looking for

  • IPod connection problem.

    When I attached my iPod a message appeared stating: "The iPod cannot be updated. The disk could not be read from or written to." What does this mean and how do I fix the problem?

  • HT3582 the camera icon is no longer on my iphone screen

    My son has been playing with my phone again and i now do not have the camera icon. How do i get my camera back?

  • Creaton of PO with referance to info record

    Hi I am trying to create PO with referance to info record. Process : In ME21N directly input info record number in line item coloumn in item overview area. My info recored is combination of material,plant,vendor as well as purchase organization. But

  • How to use macros in InCopy

    I am having an issue using InCopy and the macro section. I am a new user to InCopy, and I'm trying to figure out how to: Use a code that means something. For example: AB = $5.00 On my document, I at all times want AB to be there until I tell it to in

  • Apple apps won't launch after update to Yosemite

    Hi all, I'm unable to launch and Apple apps (app store, email etc) after update from Lion to Yosemite. I've got a crash report but don't seem able to post it here for some reason. Any ideas?