feat: Player can move around his Planet
This commit is contained in:
parent
d92730db13
commit
9f58fa4a33
|
@ -78,6 +78,9 @@ class Arrow extends Entity {
|
|||
}
|
||||
|
||||
void renderDebug(Batch batch, BitmapFont font) {
|
||||
|
||||
// TODO : dirty, do it in an other way
|
||||
if (!hasLanded()) {
|
||||
font.draw(batch, "TTL = " + this.TTL, this.position.x, this.position.y + font.getCapHeight()*5);
|
||||
font.draw(batch, "pos = " + this.position, this.position.x, this.position.y + font.getCapHeight()*4);
|
||||
font.draw(batch, "speed = " + this.velocity, this.position.x, this.position.y + font.getCapHeight()*3);
|
||||
|
@ -85,5 +88,6 @@ class Arrow extends Entity {
|
|||
font.draw(batch, "force = " + this.force, this.position.x, this.position.y + font.getCapHeight()*1);
|
||||
font.draw(batch, "angle = " + this.angle, this.position.x, this.position.y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package bzh.fainsin.sagittarius;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button;
|
||||
|
||||
class Player extends Entity {
|
||||
|
||||
|
@ -40,12 +44,19 @@ class Player extends Entity {
|
|||
|
||||
void update(float deltaTime) {
|
||||
|
||||
// TODO : do eventListening instead of polling
|
||||
// TODO : if player moving, add his speed to the arrow
|
||||
|
||||
if (Gdx.input.isKeyPressed(Keys.LEFT)) {
|
||||
this.angle += 100.0f / home.getRadius();
|
||||
} else if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
|
||||
this.angle -= 100.0f / home.getRadius();
|
||||
}
|
||||
|
||||
computePosition();
|
||||
|
||||
bow.update(deltaTime);
|
||||
|
||||
// this.angle += 100.0f / home.getRadius(); // TODO : debug, remove later
|
||||
|
||||
}
|
||||
|
||||
void computePosition() {
|
||||
|
|
|
@ -39,7 +39,6 @@ public class SagittariusGame extends Game {
|
|||
playerList.add( new Player(planetList.get(0)) );
|
||||
|
||||
arrowList = new ArrayList<Arrow>();
|
||||
|
||||
}
|
||||
|
||||
static void update(float deltaTime) {
|
||||
|
|
Loading…
Reference in a new issue