Add ball and paddle

This commit is contained in:
2018-11-10 22:30:23 +04:00
parent c9fda66879
commit bb6ecf2923
4 changed files with 114 additions and 15 deletions

View File

@ -2,22 +2,23 @@ package com.me.brickbuster;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.me.brickbuster.entity.Ball;
import com.me.brickbuster.entity.Paddle;
public class BrickBuster extends ApplicationAdapter {
public static final int WIDTH = 800;
public static final int HEIGHT = 600;
public static final String TITLE = "Brick Buster";
public static final int WIDTH = 800;
public static final int HEIGHT = 600;
public static final String TITLE = "Brick Buster";
Ball ball;
Paddle paddle;
ShapeRenderer shapeRenderer;
@Override
public void create () {
this.shapeRenderer = new ShapeRenderer();
ball = new Ball();
paddle = new Paddle();
}
@Override
@ -26,16 +27,14 @@ public class BrickBuster extends ApplicationAdapter {
Gdx.gl.glClearColor(0.5f,1,1,1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
this.shapeRenderer.begin(ShapeType.Filled);
this.shapeRenderer.setColor(Color.CHARTREUSE);
this.shapeRenderer.circle(0,0, 100, 50);
this.shapeRenderer.end();
ball.render();
paddle.render();
}
@Override
public void update(float dt) {
ball.update(dt);
paddle.update(dt);
}
@Override