Skip to content
Snippets Groups Projects
Select Git revision
  • 4f177089ab1ea6d82ba9f1316ec9a343f3728806
  • master default
  • renovate/selenium.version
  • renovate/assertj-core.version
  • renovate/major-fontawesome.version
  • renovate/datatables.version
  • renovate/opencsv.version
  • renovate/org.springframework.boot-spring-boot-starter-parent-3.x
  • renovate/junit-jupiter-engine.version
  • renovate/testcontainer.version
  • demo
  • v1_8_1
  • v2.18.1
  • v2.18.0
  • v2.17.2
  • v2.17.1
  • v2.17.0
  • v2.16.1
  • v2.16.0
  • v2.15.1
  • v2.15.0
  • v2.14.0
  • v2.13.0
  • v2.12.0
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • testPipeline2
  • v2.7.0
32 results

base_en.properties

Blame
  • Ball.java 1.14 KiB
    package de.bricked.game.balls;
    
    import javafx.geometry.Point2D;
    
    public class Ball
    {		
    	private BallType type;
    	private double gameHeight;
    	private double ballRadius;
    	private Point2D direction;
    	private final double START_ANGLE = 40;
    	
    	public Ball(BallType type, double gameHeight)
    	{	
    		this.type = type;
    		this.gameHeight = gameHeight;
    		this.ballRadius = (gameHeight * type.getSizeFactor()) / 2;		
    		this.direction = new Point2D(0, 0);
    	}
    	
    	public void startBallToRight()
    	{
    		direction = new Point2D((gameHeight * type.getSpeedFactor()) * Math.cos(START_ANGLE), - ((gameHeight *  type.getSpeedFactor()) * Math.sin(START_ANGLE)));
    	}
    	
    	public void startBallToLeft()
    	{
    		direction = new Point2D(- ((gameHeight * type.getSpeedFactor()) * Math.cos(START_ANGLE)), - ((gameHeight * type.getSpeedFactor()) * Math.sin(START_ANGLE)));
    	}
    
    	public BallType getType()
    	{
    		return type;
    	}
    
    	public double getBallRadius()
    	{
    		return ballRadius;
    	}
    
    	public void setBallRadius(double ballRadius)
    	{
    		this.ballRadius = ballRadius;
    	}
    
    	public Point2D getDirection()
    	{
    		return direction;
    	}
    
    	public void setDirection(Point2D direction)
    	{
    		this.direction = direction;
    	}
    }