Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

gravity in java

    GRAVITY = 10;
    TERMINAL_VELOCITY = 300;
    vertical_speed = 0;

    public void fall(){ 
    this.vertical_speed = this.vertical_speed + GRAVITY;
    if(this.vertical_speed > TERMINAL_VELOCITY){
        this.vertical_speed = TERMINAL_VELOCITY;
    }
    this.y = this.y - this.vertical_speed;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #gravity #java
ADD COMMENT
Topic
Name
9+2 =