Learn Java 2.7- Game Applet- Adding Friction

This entry is part 7 of 37 in the series Java Applet - Game Development

Learn Java 2.7- Game Applet- Adding Friction

Learn Java 2.7- Game Applet- Adding Friction

In this java game applet tutorial, we will add some friction to our ball which will make the motion more realistic.

If you have any programming questions, or just want to make some new friends, check out our forum at http://www.mybringback.com/forum.

All of our tutorials are also located at http://www.mybringback.com/tutorials

Also, if you want some other things to do, like us on facebook, and follow us on twitter @mybringback.

Previous Lesson
Next Lesson

Author: trav

I'm just an average guy that love programming.

Share This Post On

1 Comment

  1. Really nice tutorials man, well done! Although if you want to stop the ball from shaking on y, you can add in
    if(y==this.getHeight()-radius-1)
    {
    dx*=xFriction;
    if(Math.abs(dx)<.8){
    dx=0;
    }
    }
    this
    if(y==this.getHeight()-radius-1)
    {
    dx*=xFriction;
    if(Math.abs(dx)<.8){
    dx=0;
    }
    if(dx==0){
    dy=0;
    }
    }
    That will make it completely stop.

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>