Set launch angle
This commit is contained in:
parent
733f75830f
commit
b127c62bb4
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,5 @@ public class Block extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(float dt) {
|
public void update(float dt) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user