feat: bow cancel function
This commit is contained in:
parent
ed9e805c88
commit
ce3b1e265a
|
@ -2,6 +2,7 @@ package sagittarius.model;
|
|||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
@ -41,10 +42,12 @@ public class Bow extends Actor {
|
|||
aim = this.anchor.cpy().sub(GameScreen.worldCursor);
|
||||
angle = aim.angleDeg();
|
||||
power = MathUtils.clamp(aim.len(), 0, 1000);
|
||||
} else if (pressed) {
|
||||
} else if (pressed && power > 50) {
|
||||
pressed = false;
|
||||
GameScreen.playerCurrent.setActive(false);
|
||||
GameScreen.arrows.addActor(new Arrow(angle, power, GameScreen.playerCurrent));
|
||||
} else {
|
||||
pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +55,7 @@ public class Bow extends Actor {
|
|||
public void drawDebug(ShapeRenderer shapes) {
|
||||
super.drawDebug(shapes);
|
||||
if (pressed) {
|
||||
if (power > 50) shapes.setColor(Color.RED);
|
||||
shapes.line(this.anchor, GameScreen.worldCursor);
|
||||
if (aimAssist) {
|
||||
float[] traj = Arrow.traj(angle, power, GameScreen.playerCurrent, 400, 0.05f);
|
||||
|
|
|
@ -112,7 +112,7 @@ public class GameScreen extends BaseScreen {
|
|||
int index = players.getChildren().indexOf(player, true);
|
||||
if (index < playerIndex) {
|
||||
players.removeActor(player);
|
||||
//playerIndex++; // ? keeping ?
|
||||
playerIndex++;
|
||||
playerIndex %= players.getChildren().size;
|
||||
} else if (index == playerIndex) {
|
||||
players.removeActor(player);
|
||||
|
|
Loading…
Reference in a new issue