Set launch angle

This commit is contained in:
BlueNutterfly 2018-11-11 13:12:09 +04:00
parent 733f75830f
commit b127c62bb4
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.me.brickbuster.entity;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.me.brickbuster.BrickBuster; import com.me.brickbuster.BrickBuster;
@ -38,7 +39,8 @@ public class Ball extends Entity {
} }
public void launch() { public void launch() {
direction = new Vector2(0, 1); float angle = MathUtils.random(MathUtils.PI/2) + MathUtils.PI/4;
direction = new Vector2(MathUtils.cos(angle), MathUtils.sin(angle));
speed = 5; speed = 5;
} }
} }

View File

@ -23,6 +23,5 @@ public class Block extends Entity {
@Override @Override
public void update(float dt) { public void update(float dt) {
} }
} }