Which is best?

I have a couple of questions regarding sprite animation in Java, I know a lot of you might say "we've seen this all before" but most of the answers I've found relate to specific Java game API's, which I don't want to use, I'd like to have a shot at doing it myself, so that I actually learn! So! Which is the best way of doing Sprite animation with the Java2D API:
1) Use a single image (sprite sheet) and have a PixelGrabber "grab" the bits you need as and when you need them.
2) Use lots of individual images to make up the frames of animation, cycling through an array of Images. (this is what my app. uses)
And how is it best to time the animation:
1) Use some kind of thread seperate from the main one, use Interrupts to determine when updates are required.
2) Use a javax.swing.Timer that calls repaint 24 times a second and have the game logic run on a seperate timer. (this is what my app. uses)
The reason I ask, is that I have implemented a simple extensible animation system, but it runs very slow on anything under about 800Mhz, any ideas? For those interested, my full source code is available here:
http://www.macs.hw.ac.uk/~ceetfc/ait/ait.zip
Hope someone can shed some light on what I'm doing wrong.
Cheers,
Tom

You can have the animations and game logic on the very same thread (and should in my opinion). Just call the animations "update" everytime you loop through your game logic. If you don't want to perform the animation every loop (which I am guessing you don't), then pass the time that has passed since the last update call, and once enough time has gone by, then do update. Something to the extent of this in your animation code....
public void update(long timePast) {
   timeSinceUpdate += timePast
   if (timeSinceUpdate  >= UPDATE_TIME) {
            timeSinceUpdate = timeSinceUpdate - UPDATE_TIME;
             ........[insert your stuff here]........

Similar Messages

  • Which the best adapter vga to plug a data show on a macbook pro, mini displayport or thunderbolt?

    which the best adapter vga to plug a data show on a macbook pro, mini displayport or thunderbolt?
    Why?
    Thanks pals.

    Use the Apple Cable Chooser:
    http://store.apple.com/us/browse/home/shop_mac/mac_accessories/cables/cable_choo ser

  • Should I use a table for thumbnails? [was: Experts,  which is best for me?]

    on some of the pages on my web-siteI am going to have several (perhaps approx 10 pages) with 12 or 15 thumbnail photos on it.
    I am then going to link each thumbnail to another page which will have a larger version of the thumbnail along with a brief description of the photo.
    I am hoping to have all pages taken from a template base with just a header and a navigation bar (pop menu magic from PVII). I want to link the pages with the large photo back to the thumbnails page.
    Before I start on my site, I would be interseted to find out what some of you experts out there would advise with regard setting my site up.
    I know there are horses for courses and many different opinions so i don't think I will get a definitive answer.
    My question is, for my type of site as described above, which is best, Tables, div tags  or both together. i.e. Div tag for header, div tag for nav bar and a table in a div tag.  and your reasons why would be helpful. I know that this has been discussed many times but I want to know answer specifically for my web-site and not which is best generally.
    I hope my question is clear enough and thanks in advance for any feedback.
    [Subject edited for clarity by moderator]

    It may sound as if I am being lazy here but is it easy to integrate JAlbum in to my site. Is it a case of copying and pasting or does it entail a lot of knowledge.
    I am not really being lazy, I just want to get things moving so that when I get round to building my site, I can keep moving at a steady pace.
    My website which I have up already is www.designekitchens.co.uk if you want to give yourself a better idea of what is required.
    Does using a slide show mean that I loose some pages so less chance of being spidered by search engines?
    I don't think I could manage all this if there were no forum so thanks again.

  • Which is best port for connecting external pc vga monitor to macbook pro

    which is best port to connect my macbook pro to external via monitor?

    not sure what you feel your options are most macbooks pro have a minidisplay port or a thunderbolt port which is the same connector
    and all minidisplay -> hdmi or dvi or vga works

  • 5 Ways to Handle Sales Orders in IC WebClient: Which is Best for You?

    Hello Interaction Center community!
    If your IC project includes CRM Sales, or if you are considering adding support for sales processes, check out the following article which has been posted by permission of CRM Expert
    (crmexpertonline.com) and Wellesley Information Services.
    [5 Ways to Handle Sales Orders in IC WebClient: Which is Best for You?|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3040e1d3-da06-2b10-afa3-e0952aac10a1]
    We want your feedback. Which sales option are you using in your project? What were the main decision criteria? Please reply with your input. At least two points will be rewarded

    Over 90% of our orders come in via CRM ISA or EDI.
    B/c of the reasons mentioned in the article we use R/3 for entry of the remaining orders as well as order management.  Since R/3 was live years before CRM, there are custom exits and fields required that would be an investment to replicate.  Changing the plant on the line item is a common occurance for our business.  Of the CRM scenarios X,Y,Z we use scenario X where once the order is touched in R/3, R/3 becomes the owner of the order.
    Our CRM version just upgraded to 5.0 and our R/3 system is now being upgraded to ECC 6.0.  As our do use the IC web client, we are investigating trying to move to the ERP Sales order.  The upgrade architecture will also open scenario A where either CRM or ECC could change an order even though X should still support our requirements.
    Glenn

  • Multiple video players in Java application .... which is best format ?

    Hey there
    we are working on an application that will allow six video players to run similtaneously in a frame (actually a J Layered Pane) - you can drag these around + rearrange them.
    At present we are testing a whole load of different formats + codecs to see which performs best - the piece will end up in a gallery so we need to push quality + resolution as high as possible.
    .avi works best so far - using cinepak @ 70% quality .... .mov does not work at all .... does anyone have advice as to the most suitable format ?
    many thanks
    John Gerrard
    [email protected]

    MPEG-4
    Make sure you don't infringe on any copyrights.

  • Which is best way to back an iMac?

    Which is best way to back an iMac? I have lots of photos and videos on my iMac TIme Capsule or hard drive. I would like to take photos and videos off my iMac but would easy access to them.

    steve359 wrote:
    CCC stores a "base image", then its incremental backups are stores in separate folders that you would have to search for specific files.  If different files were "last changed" on different days, you may have to search different days "incremental folders" to get all files.
    Because of this CCC is "managed" ... you cannot fully control how backups are made or where files are stored.  And TimeMachine eventually deletes "incremental folders" as they get too old, so it is "managed" as well.
    If you have full sets of files you want saved "as a specificslly formatted set", I would do it in another eternal drive that *I* manage as a set of folders.
    This is totally 100% incorrect. What you described here is more or less Time Machine, not CCC.  CCC is a standard backup program.  It does not, I repeat, NOT, create incremental dated backups.  While you can save what gets replaced by date archived directories that is not the intent of CCC.  It's intent is to have a exact disk image, folder-for-folder, file-for-file, of the source.  Under option it just stuffs the files it replaces in a folder.
    And you switch what your are taking about halfway through your post to TM.

  • Aperture Vault vs Time Machine~which is best to retrive photos with all info

    Aperture Vault vs Time Machine~which is best to retrive photos with all info?

    Both will restore your Aperture library. And both will not allow to restore single images. You always have to restore the complete library.
    The difference is, that Aperture vaults are archival backups. You make a snapshot at a certain point of time. Time Machine will give  you the option to go back in time to several different moments. A vault is snapshot of only one moment and you would need to create several vault to be able to go back to earlier versions of the library.

  • CBR vs VBR which is best

    I realize there have been alot of postings (mainly mine) on this subject but........
    Which is best and under what circumstances would you use these. I have been reading about this and it still is'nt clear. I have vers. 2 on my desktop and 2.1 on my laptop. All answers I have suggested that CBR is best, but is this all the time?
    Jeff
    G4 DP 1 GIG G4 laptop 1.25, MBP 2.0 1 GIG   Mac OS X (10.4.6)  

    Jeff:
    My two cents . . .
    I'm using Compressor 2.0. With the standard VBR presets I use to get some pixelation in particular in transitions. That's solved using same preset changing just to CBR setting.
    My projects uses to be short and then a bigger m2v ile size is not a problem for me.
    Someone using 2.1 could tell us if the VBR problems have been solved.
    Hope it helps !
      Alberto

  • Hello! Which is best to choose a plan for IPhone country Russia?

    Which is best to choose a plan for IPhone country Russia?

    Aivaryamal wrote:
    What about this site to buy the iPhone, which works with MTS and Beeline? throw off the link, please?
    I do not know anything about MTS or Beeline - are they GSM carriers, do they offer LTE and if so, on what frequencies?
    The USA online store sells unlocked iPhones, which are model A1428 and is the same model phone as sold carrier-locked to AT&T here.  But again, you cannot buy anything from the USA online unless you have a USA billing address, USA-issued payment source (e.g. credit card) and have it shipped within the USA.  If you are in Russia, you need to buy from a site that sells in Russia, not from the USA online Apple Store.

  • I have to run Windows for work, which is best Parallels, Fusion, or Boot Camp? I won't need to share anything with the Mac Side.

    I have to run Windows for work, yuk! Which is best Parallels, Fusion, or Boot Camp? I will not need to share anything with my Mac side as I will just be running one program to chat on the web and send Emails.

    Parallels, Fusion and VirtualBox are all virtualization applications, they 'virtualize' (create) a Windows environment on your Macs OSX operating system.
    Boot Camp makes a compatible partition on your hard drive so you may install windows on it directly.

  • Is there a website or PDF somewhere which discusses best practices for producing a children's picture book? I am mostly interested in requirements for good image format, resolution, etc.

    Is there a website or PDF somewhere which discusses best practices for producing a children's picture book? I am mostly interested in requirements for good image format, resolution, etc.

    There may be a few links in Apple Support, regarding articles about how to use iBooks Author
    and iBooks Store, etc; these would be separated into two general categories by device used.
    Since there is an iOS and an OS X version of each, you may have to look to see what Apple
    Support says about the one you are interested in; and how far their database goes toward an
    answer to your question. Otherwise, a general search engine approach may be necessary.
    Not sure if anything along the lines of what you seek would be available in an App.
    References to iBooks Author and iBooks Store, etc appear within these two categories in Support:
    For Mac OS X:
    http://www.apple.com/support/mac-apps/
    For iOS:
    http://www.apple.com/support/ios/
    Appears a community host moved your earlier post into one of the iBooks Author or Store sections
    after I'd replied to what otherwise may be a similar post. Not sure if the links to the Discussions area
    of iBooks you are interested in, have similar questions or answers by others who'd visited previously.
    Is there a website or PDF somewhere which discusses best practices for producing a children's picture book? I am mostly interested in requirements for good image format, resolution, etc.
    In my reply to your earlier thread, prior to it being moved, those links to sections of iBooks Author, etc
    are posted. You can also find them from the main Apple Support Communities page.
    Sorry to not be of much help in this matter.
    Good luck & happy computing!

  • Which is best video format for storage of video media files?

    Greetings, good folk and happy holidays!
    My question involves the conversion of physical video media, DVDs, video files, etc, and storage for use with multiple devices.
    Like many of you, I have video in many formats and in multiple places... DVDs, Blu-Ray, AVIs, MP4s, etc.  I want to convert them all to a usable format to use in conjunction with my Iphone, Apple TV, IPad, etc. and store in one place in an electronic "library." The problem is that there are countless formats they can be converted to, and not all formats look good on all devices. A video converted to Iphone format will be optimized for the smaller screen and may not look good on the iPad. And iPad converted video might not look good on larger TVs used with Apple TV.
    Was wondering if you folks would have opinons as to the best codecs, format and specs to convert video to that would look good on any device from iPhone to an iPad to a TV with Apple TV. 
    I'm not expecting Blu-Ray quality sharpness with a universal format when used with Apple TV, but something reasonable without artifacts would look fine.
    I'm using IM Too Video Converter Ultimate which has presets for many difference devices, but not sure which options will work best.
    Anyone else dealing with this?
    Thank you for your time.

    MPEG-4
    Make sure you don't infringe on any copyrights.

  • I phone 5 need to use antivirus? If i need to use antivirus which is best app for i phone 5

    I phone 5 need to use any antivirus ? If i want to use which is the best app for i phone 5

    It is certainly not a virus. There are none.
    Try the basic troubleshooting steps.
    Start here: http://www.apple.com/support/iphone/assistant/phone/#section_1
    Sometimes all that is required is to restart the iPhone.
    The final step is to restore it. Always back up your iPhone first.

  • Which is Best way to pool DB connections on Server no-J2EE???

    I have a applicatio, which run on very different app servers (WebSpere, JRun and i-Planet)... the db conncetion problems existe whit server no-J2EE compliant, like as i-Planet.
    On J2EE servers I cant use Server DataSource to pooled connection, and server make this work transparently and good.
    But, if have to manually manage to pool connection, which is the best way?
    Befor use Poolman package... by CodeStudio, but is not effective for me...
    Now, are studying the Jackarta-Commons DBCP...
    Which is the best ?... there is other solution for this problem ?.
    thx !

    App in I'm work, make exhaustive use of db connection,
    only on startup, use a average of 130 connection
    request on less 10 secconds.
    All connection requested, when finish to use, there
    are closed, supposeddly, the closed connction are
    returned to pool, but this no happend it quickl, How do you know it doesn't happen quickly?
    Normally a returned connection would just be inserted into a list with a possible state change. That would be very quick in java. It might check the state of the connection and that is going to take longer Another pool manager might do the same though.
    then,
    if pool is able to create emmergency connections (up
    num max) always returned new connection, any one
    else, if pool can't create emmergency connection
    objects, app wait for free connection of pool... long
    delay !Of course, but any pool is going to do that.

Maybe you are looking for

  • Issue in clearing workflow notification

    Hi, Oracle EBS:11.5.10.2 OS: AIX 5.3 after resolving the workflow issue i had a stopped queue of of around 5000 mails. to purge that queue I followed the oracle Action plan. 1. Stop Workflow Agent Listeners and Mailers 2. Find the tablespace where in

  • HP won't boot up after Windows 8.1 update

    I downloaded Windows 8.1 on Friday night, finally was able to install it on Sunday afternoon, don't know why it took so long. Regardless, the computer installed 8.1 and restarted itself. After booting back up, the computer would be at the desktop (no

  • What's the differece  between BI client 000 and 001 ?

    Hello exports, We copy the client 000 to client 100,  then we done the configuration "Integration into Portal " at client 100. But we can't success, we found that client 100 miss 7 system users( J2EE_ADMIN,SAPJSF,SLDDSUSER and so on). After we create

  • Error in planning sequence- 'Cannot generate combinations of multiprovider'

    Hi Gurus,                    I am facing a problem while executing my planning sequence in modeller. Aggregation level contains all characteristics in multiprovider. Multiprovider contains actual and planned cubes. Filter is based on product name in

  • How you organize photos without Aperture ?

    Once again, which scheme do you use for organizing photos apart from Aperture built in engine ? Do you name folders like 2006-08 New York or 06-08 New York ?