Best way to move sprites around in the scene?

What is the best way to move sprites around on the scene?
So far I came up with this code to move all the sprites from the right to the left
var anim = Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames: KeyFrame {
time: 0.1s;
action : function(){
for(n in container.content){
def item = n as Sprite;
item.posX -= 2;
it moves the sprites for 2px every 0.1s, but it's not so smoth.
Is there a better way for doing it?

netsuvi wrote:
But this approach limits me in someway that i am unable to change yet. It means that I have to know
the end position on the sprite at the beginning? But how about user interaction? I would like to adjust the speed, during running.
Or how about collision detections?To use this technique, you have to know the end position, at least provisionally, at the start.
If something changes during the timeline (such as the user clicking) you can always stop the timeline
and recompute a new trajectory and start another timeline.
Collision detection is harder, especially among objects that are all moving.
I saw some people are just generation tics. Like 10 per seconds, Then then calculate the whole stuff in a function.
probably it would be enough to have 2 calculation tics per second and let the javaFX engine calculate the necessary frames in between.This is a reasonable approach, and it's fairly straightforward. However, even in some cases like BrickBreaker, you can compute
the endpoint or do collision detection (mostly) up front without having to compute frame-by-frame. For example, when the ball
is heading up, you can tell from its position and velocity whether it's going to hit a brick or a wall and when it will hit. When the
ball is heading down, you don't know whether the ball will hit the paddle, because the user can move it. However, the paddle
moves only horizontally along a certain Y-position, so you can compute the time and location at which the ball will reach that
Y-position. If the paddle is there, it bounces, otherwise the ball drops off the bottom and the turn ends.
If you want to compute collision detection among two or more moving objects, well, that's a lot harder. It probably requires doing
a bunch of math, and it might be possible to do in closed form. If not, successive approximation might be the easiest way to do
it.
So in pseudo code it would something like this:
Animation Start 0Seconds: Sprites have this position
Animation Start 0.5Seconds: Move sprite to this position // JavaFX makes the in between steps
do function() {
calculate speed,
calculate collision detection or whatever
then restart the Animation steps.I think the key is to decouple the position and collision computations from the actual graphics animation.
For example, suppose you have an object heading towards a wall that's 500 pixels away, and it's moving at 250
pixels/sec. (Assume constant velocity.) Then you know that the object will be at the wall in 2 seconds, so
you just set up a KeyFrame with that information, put it into a Timeline, and run it. You'll need to put an action
function in the KeyFrame as well. But note that this doesn't necessarily compute the next 0.5 seconds or the
next 2 seconds. Instead, it should look at the new state and compute the time at which the next event occurs
and then set up KeyFrames to run all the objects until that time.
I tried something with the timeline.playFromStart() but it didn't work. It just repeated the same animation instead of doing a new one.
You have any clue how to do that?The playFromStart() function will simply replay the same animation, as you noted. What you want to do is
recompute KeyFrames starting from the current state that show animation to some future state. Then,
load these KeyFrames into the Timeline (or create a new Timeline) and run it.

Similar Messages

  • Best way to move Users folder off the boot drive

    I read a couple of old threads regarding this topic, but I have some lingering questions...
    I'm awaiting my Mac Pro. I ordered it with one drive. I plan on adding two drives in a RAID 0 array for data (which will be backed up regularly, of course) as soon as I get the Mac.
    This is my first Mac, so I've got some questions (long time PC user as well as AIX & Linux user):
    1. Is it better to move the entire /Users folder or just selected /Users/<user_name> folders? I'm thinking it's safer to just move selected /Users/<user_name> folders (e.g. my "everyday" accoun'ts home directory, other family members' home folders, and the /Users/Shared folder). That way, in the event that I have a problem with my data drive (a RAID 0 array), I can login as an admin whose home folder is still in the boot drive and I won't have any problems logging in as that user when doing maintenance.
    2. Is it safe to move (and delete from the boot drive) the /Users/<user_name>/Library folder? Note that I plan on moving the home folders on a brand new Mac, but will things get messed up if I delete /Users/<user_name> folders from the boot drive once I've moved them to the RAID array?
    3. Are there any ill-behaved programs that expect Users to be in the boot drive, so I have to create a /Users/<user_name> soft link that points to the actual folder in the RAID array?
    4. I believe I found the steps suggested in Pogue's Mac OS X Missing Manual book (although it's in the context of moving the folder to an external drive). Basically, it entails running:
    a. sudo ditto -rsrc "/Users/<user_name>" "/Volumes/<thenewhome>"
    b. Then, in Accounts pane of System Preferences under Advanced Options, enter the new Home folder.
    c. Reboot and delete the original /Users/<user_name>
    Does this sound right? Seems really simple (much easier than in the Windows world).
    Thanks.

    Just wanted to clarify:
    1. Mike Bombich's method entails moving the entire /Users folder to another drive so everyone's home is moved?
    2. David Pogue's method (as described in the Missing Manual) only entails moving individual, selected home folders to another drive (and no soft links needed)?
    3. It sounds like Pogue's method is preferable anyway (for the paranoid at least), so if the 2nd drive dies or needs maintenance, I can still login as a user whose home folder is in the boot drive?
    4. So, if I use Pogue's method, all that is needed are the steps listed in my original post above, and nothing else?
    Thanks.

  • What's the best way to move files from my old G3 to my new Intel DuoCore?

    I just received my new Intel DuoCore 17" iMac. For years I have been using a much-loved G3 500 mHz iMac. The new Intel iMac is still in the box, but I believe it shipped with OS 10.4.4. The G3 runs 10.2.6. I have a dial-up connection to the Internet; currently DSL is not available in my neighborhood. What is the best way to move my files from the G3 to the Intel dc? Can I simply connect them with an Ethernet cable and transfer files directly? Or is my best bet to simply save the files I want to transfer to a disc and do it the old-fashioned way? Please forgive me in advance for my ignorance; although I have been a Mac user and supporter for many years, I am astonishingly ignorant when it comes to the best way to using both Mac hardward and software.
    iMac Intel DuoCore   Mac OS X (10.4.4)  

    There are two issues - 1. Getting the files moved over, and 2. Being able to open them on the Intel iMac.
    1. This can be technically easy if you are willing to spend the time. I moved all my stuff from my old Mac to my new one by hooking the two together with an ethernet cable, directly. You would need both machines to have appropriate IP addresses. (go to the network preferences and pull down the built-in ethernet panel.) Some addresses such as 192.168.1.100 and 192.168.1.101 would work with a subnet mask of 255.255.255.0) Now go to the new iMac and make sure the finder is selected (click on the desktop) and under the "GO" menu select "Connect to Server". You will need to put in the IP address of the old machine, and later it's administrative password. Then select its hard drive from the list (possibly only one choice) and it should appear as an icon on your iMac desktop. You can open this like any other drive and just drag items to the new iMac.
    2. Whether you can use all the files moved over from the old G3 is difficult to answer. You may be using Classic mode sometimes on the G3 and have some stuff created with a Classic application. You are probably aware that the new Intel iMac does not support Classic mode, so some of these files may not be useable without a bit of work (or at all, perhaps.) For instance I had to purchase Appleworks to handle some of my old Clarisworks documents because Pages couldn't understand them. Once I had them converted to Appleworks documents, I could then convert them again to Pages documents.
    I had some old MacDraw Pro documents that were equally problematic.
    I would advise you to get the new iMac out of the box and connected to your dialup internet connection first. Do all the software updates until running software updater says there is nothing new. Then you will be at 10.4.7 with all the latest security and fixes etc. Then disconnect from the internet and use an ethernet cable to get the stuff off the old computer.
    There will be lots more to do such as moving your mail, address box entries etc. later, but this is a start.

  • Best way to move all music to new hard drvie and computer

    I'm updating my existing computer, will be installing Vista home premium to new hard drive on new computer, using some of my existing hardware - setting up existing hard drive as secondary drive to move data over - I was hoping to backup all itunes files to the hard drive and then restore from backup to new drive but I can only backup to DVD - which i dont want to do. Once Itunes is setup on the new computer, whats the best way to move all files from the old directory without losing the purchased folder and all settings? thanks.
      Windows XP Pro  

    Make the drive name the same as the old one, or point to the first file when asked. PR will then find the rest of the files, at least if they are in the same directory.

  • What's the best way to move around in a document?

    Maybe I'm missing something obvious here, but what's the best way to move around in a zoomed in document?
    The only method I've found so far is to drag with two fingers, which keeps resizing the document as it moves around.
    No Hand Tool? No way to zoom to 100%? No way to Fill the Screen with the document?
    Let me know, thanks.

    Hi,
    Panning is being done with two fingers, i.e. you set two fingers down on the screen and then move them in the same direction.
    You can also zoom out by moving the fingers in the opposite direction as when you zoomed in.
    Thanks,
    Ignacio

  • HT1751 What is the best way to move my iTunes library from an external PC drive to a Mac external drive?

    I just make the move to Mac computers.  My iTunes library is currently on a PC formatted external drive.  I would like to move it to an external drive that i have formatted for Mac.  What is the best way to do this?

    Is the entire library on the external drive or just the media folder? If it is the latter, and you still have access to the PC then see make a split library portable.
    If the drive is in FAT32 format you can connect a portable library directly to the Mac, holding down Option as you start iTunes. Otherwise you either need to copy it to a local drive (Mac should be able to read NTFS) or install a full service NTFS driver so that the library can be read and updated.
    tt2

  • What is the best way to move multiple formats of songs/photos/podcasts to a new computer?

    For most of my life, I have used my family's home Windows desktop to establish my iTunes account with my iPod Classic (5th gen). On this computer I have:
    iTunes store purchases
    CD imports
    Other MP3 files
    Podcasts
    Photos downloaded from online
    Now I am in college in another city, and I won't be able to come home much, so I'm setting up iTunes on my laptop as my new "home base", as it were. I've already authorized it under the same account that I use on my desktop. What is the best way to move all of this stuff from my old computer to my new one? I'm thinking an external hard drive is the best decision, but I want the input of the Apple community. You guys are much more knowledgable than I am! Thanks!

    Hey Alayna,
    Welcome to Apple Support Communities, and thanks for the question! I'm not really in a position to recommend a "best" option, as there are several different ways to go. You can read over your options in the following document and decide which one works best for you:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Have a good one,
    David

  • I am moving from PC to Mac.  My PC has two internal drives and I have a 3Tb external.  What is best way to move the data from the internal drives to Mac and the best way to make the external drive read write without losing data

    I am moving from PC to Mac.  My PC has two internal drives and I have a 3Tb external.  What is best way to move the data from the internal drives to Mac and the best way to make the external drive read write without losing data

    Paragon even has non-destriuctive conversion utility if you do want to change drive.
    Hard to imagine using 3TB that isn't NTFS. Mac uses GPT for default partition type as well as HFS+
    www.paragon-software.com
    Some general Apple Help www.apple.com/support/
    Also,
    Mac OS X Help
    http://www.apple.com/support/macbasics/
    Isolating Issues in Mac OS
    http://support.apple.com/kb/TS1388
    https://www.apple.com/support/osx/
    https://www.apple.com/support/quickassist/
    http://www.apple.com/support/mac101/help/
    http://www.apple.com/support/mac101/tour/
    Get Help with your Product
    http://docs.info.apple.com/article.html?artnum=304725
    Apple Mac App Store
    https://discussions.apple.com/community/mac_app_store/using_mac_apple_store
    How to Buy Mac OS X Mountain Lion/Lion
    http://www.apple.com/osx/how-to-upgrade/
    TimeMachine 101
    https://support.apple.com/kb/HT1427
    http://www.apple.com/support/timemachine
    Mac OS X Community
    https://discussions.apple.com/community/mac_os

  • What is the Best way to move large mailboxes between datacenters?

    What is the Best way to move large mailboxes between datacenters?

    Hi, 
     Are you asking with regards to on-premises Exchange? With Microsoft Online SaaS services (aka Exchange Online) there is no control and no need to control which data center a mailbox resides in.
     With regard to on-premises Exchange, you have two choices: you can move it over the WAN in which case you would either do a native mailbox move (assuming you have Exchange 2010 or later you can suspend the move after the copy so you can control the
    time of the cutover) or create a database copy in the second data center and once the database copies have synchronized change the active copy.
    The other choice is to move is out of band which would usually involve an offline seed of the database (you could conceivably move via PST file but that would disrupt access to the mailbox and is not really the 'best way').
    In general, Exchange on-premises questions are best asked on the Exchange forum: http://social.technet.microsoft.com/Forums/office/en-US/home?category=exchangeserver
    Thanks,
    Guy 

  • What is the best way to move my itunes from one computer to another and retain all files?

    what is the best way to move my itunes from one comupter to another?

    I assume you mean the media and playlists, not the iTunes application.
    http://support.apple.com/kb/HT4527

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

  • What is the best way to move a library?

    What is the best way to move my iphoto library from this computer to an external HD? And then what is the best way to remove it from this computer?

    Make sure the EHD is formatted OS X Extended (journaled) with ownership set to be ignored.  Drag the iPhoto library from your Pictures folder to the EHD,
    When the copying is completed launch iPhoto with the Option key held down and open the library on the EHD. 
    Once you've confirmed that the move was successful and the EHD library is working OK you can drag the library in your Pictures folder to the Trash bin in the Dock and empty it.
    OT

  • HT1589 what's the best way to move content to a new library I created ie a holiday music only library?

    what's the best way to move content to a new library I created ie a holiday music only library?

    Sophie:
    Welcome to the Apple Discussions. You're only hope to recover the library as it once was is to: 1 - if you have a backup copy of your iPhoto Library or 2 - you can put everything back exactly the way it was in the Finder.
    Otherwise you'll have to start over with a new library and import the Originals folder from your current library as follows:
    Creating a new library while preserving the Events from the original library.
    Move the existing library folder to the desktop.
    Open the library package like this.
    Launch iPhoto and, when asked, select the option to create a new library.
    Drag the Originals folder from the iPhoto Library on the desktop into the open iPhoto window.
    This will create a new library with the same Events as the original library if you have the Finder checkbox unchecked in the Events preference pane.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • What is the best way to move my itunes music library from my old computer to my new one?

    what is the best way to move my itunes music library from my old computer to my new one?

    Home Sharing is option A.
    http://support.apple.com/kb/HT3819
    Option B is consolidating the library to an external HD.
    http://support.apple.com/kb/ht1364
    http://support.apple.com/kb/ht1751
    Or you can use one of the other 8000 methods. I just prefer these two.

  • What is the best way to move Contacts onto the iPhone?

    Hi Guys,
    I currently have Nokia N82, usually when i get a new Nokia (since am a TOO loyal customer) i just take a backup from the previous one and add it to the new one when i get! i hate copying to/from SIM...
    Now when i want to get the iPhone what is the best way to move the Contacts??
    i use a Windows machine, STILL!

    For the couple of iPhones I have access to, you've got three methods to get contacts onto the device aside from moving them onto the SIM; I have found that copying to and from SIMs can leave data fields not totally aligned.
    (1) Via a cloud. One uses MobileMe (via iCal/Address Book entries) and the second uses an Exchange-based cloud. Both seem to work pretty well, although I do experience an occasional lag from time to time.
    (2) Via a sync on a desktop. My preferred method. Connecting to iCal/Address Book>iTunes or Outlook 2007>iTunes work very well. My only issue was that Outlook didn't work as I'd expected the first time, just as with a couple of other phones in the past (it never did work with my Motorola Z9); to "fix" the issue, I simply refreshed Outlook's contacts and rebooted Outlook - I actually had to do the same thing with iCal to "blow out the pipes" and both sync conduits work fine now.
    (3) Transfer Contacts to the iPhone via email using a vCard for each contact. I use version 3.0-compatible vCard files generated from Address Book or Entourage (Mac), Outlook or just about what my business contacts generate. Just about every platform has some unique data type, but I haven't received a vCard yet the iPhone can't handle via email.
    Getting your Contacts out of the iPhone. Option (1) or (2) - that's it AFAIK. I hope this helps you out!

Maybe you are looking for

  • Switch statement problem

    I am doing a question in which I have to make a simple ATM program that can withraw and deposit money as many times as the user wants. To exit the program the user has to hit "x". I have to use a switch statement. Im getting incompatible type errors

  • Montior/display calibration for photography?

    What is the best way to go about calibrating my MacBook display to give me accurate color representation while working with my photographs? When I get them printed, they don't look as good as they do on my screen. All the tutorials for monitor calibr

  • UPLOADING DATA  IN A NON STANDARD TABLE

    I have a non standard table.I want to upload data in that table using SCAT.So,how Test case can be created for uploading the data in that table? Edited by: Debasish Behera on Mar 17, 2008 1:02 PM

  • Patch 111715-08

    The most recent patch to Sun ONE Studio 7 C++, 111715-08, changed the standard string class. The diff between the previous <string> header and the new one is: 32a33,34 #pragma disable_warn 798c800 < static const __null_ref_type __nullref; static __SU

  • SafariNotificati will not allow me to install adobe acrobat

    I'm trying trying to install Adobe Acrobat. the install stalls when a pop up window appears telling me to close SafariNotificati.  SafariNotificati is a push notification which runs even when Safari is not. How do I close this to install acrobat?