Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: frame issues

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default frame issues

    Im a student and i have created a game for my first year project. The game consists of trains moving from one side to the other. They are moving at a speed of 1 frame per second and each time you finish the level the speed increases by 1 frame each time. But when it gets to over 5 frames per second the images start to jump and they are not very smooth. I can not make sure how to make it create a smooth pattern across the screen.

    Any idea how to sort it out.

    Thank you for any help.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,387
    My Mood
    Hungover
    Thanks
    144
    Thanked 628 Times in 538 Posts

    Default Re: frame issues

    Can you post an SSCCE or an MCVE showing what you're doing? Note that this should not be your whole program, just enough to give us a picture of how you're doing your animation. A simple display of a moving circle would be good enough.

    But the short answer to your question is that you need to move your game objects a tiny bit very often (more than 30 times a second) rather than a further distance once per second.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: frame issues

    Quote Originally Posted by vojtech vojtech View Post
    The game consists of trains moving from one side to the other. They are moving at a speed of 1 frame per second and each time you finish the level the speed increases by 1 frame each time. But when it gets to over 5 frames per second the images start to jump and they are not very smooth.
    Please, describe and/or show the code you have used. We can't know at this moment .... are you moving a component at absolute locations? are you using custom painting in an your component? are you using javax.swing.Timer?
    Andrea, www.andbin.net SCJP 5 (91%) SCWCD 5 (94%)

    Useful links for Java beginners My new project Java Examples on Google Code

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,303
    My Mood
    Mellow
    Thanks
    194
    Thanked 669 Times in 656 Posts

    Default Re: frame issues

    Welcome to the forum! Please read this topic to learn how to post code correctly and other useful info for new members.

    What you've described can be caused by any number of common mistakes made by someone new to animation in Java. We'll be able to help you once you show us the code that matters.

Similar Threads

  1. Frame
    By Thiyagrajan in forum What's Wrong With My Code?
    Replies: 20
    Last Post: April 16th, 2013, 08:07 AM
  2. Issues with my ordering program - if statement issues?
    By Shenaniganizer in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 31st, 2012, 10:17 PM
  3. Image without a frame, is it possible?
    By knightmetal in forum AWT / Java Swing
    Replies: 5
    Last Post: August 15th, 2012, 03:52 AM
  4. Replies: 1
    Last Post: January 19th, 2012, 02:44 PM
  5. Filling the frame
    By Metadeth in forum AWT / Java Swing
    Replies: 2
    Last Post: July 11th, 2011, 03:28 PM