package com.juotos.prr.Actors;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Rectangle;
import com.juotos.prr.Constants;
import com.juotos.prr.PRRGame;

public class Player {
	private static final String PLAYER_ASSETS_DIR = "player/";
	private static final int MAX_HIT_METER = 100;
	private static final int MIN_HIT_METER = 0;
	private static final float HIT_METER_CAP = MAX_HIT_METER / 3;
	
	private PRRGame game;
	
	public boolean leftSide = true;
	public boolean jumping = false;
	public int hitMeter = MAX_HIT_METER;
	public Texture playerTexture1, playerTexture2, playerTexture3;
	public int width = 70, height = 70;
	public float x = 0f, y = 0f;
	
	public Player(PRRGame g) {
		game = g;
		playerTexture1 = new Texture(Gdx.files.external(Constants.ASSETS_DIR + PLAYER_ASSETS_DIR + "1.png"));
		playerTexture2 = new Texture(Gdx.files.external(Constants.ASSETS_DIR + PLAYER_ASSETS_DIR + "2.png"));
		playerTexture3 = new Texture(Gdx.files.external(Constants.ASSETS_DIR + PLAYER_ASSETS_DIR + "3.png"));
		
		x = Constants.GAME_WIDTH / 2;
		y = Constants.GAME_HEIGHT - height; //bottom to screen
	}
	public void update() {
		
	}
	
	public void increaseHealth(int value) {
		hitMeter += value;
		if(hitMeter > MAX_HIT_METER) hitMeter = MAX_HIT_METER;
	}
	public void decreaseHealth(int value) {
		hitMeter -= value;
		if(hitMeter <= MIN_HIT_METER) {
			hitMeter = 0;
			game.toggleGameState();
		}
	}
	
	public Texture currentPlayerTexture() {
		if(hitMeter <= HIT_METER_CAP) 
			return playerTexture3;
		else if(hitMeter > HIT_METER_CAP && hitMeter <= (2* HIT_METER_CAP))
			return playerTexture2;
		else 
			return playerTexture1;
	}
}
@@ -126,16 +126,111 @@
 exture;%0A
+import com.badlogic.gdx.graphics.g2d.Sprite;%0Aimport com.badlogic.gdx.graphics.g2d.SpriteBatch;%0A
 import c
@@ -758,16 +758,68 @@
 xture3;%0A
+%09public Texture prevTexture;%0A%09public Sprite sprite;%0A
 %09public 
@@ -877,16 +877,44 @@
 y = 0f;%0A
+%09public float rotation = 0;%0A
 %09%0A%09publi
@@ -1272,125 +1272,366 @@
 x = 
-Constants.GAME_WIDTH / 2;%0A%09%09y = Constants.GAME_HEIGHT - height; //bottom to screen%0A%09%7D%0A%09public void update() %7B%0A%09%09%0A%09%7D
+70;%0A%09%09y = 0; //bottom to screen%0A%09%09%0A%09%09prevTexture = playerTexture1;%0A%09%09sprite = new Sprite(prevTexture);%0A%09%09%0A%09%09sprite.setX(x);%0A%09%09sprite.setY(y);%0A%09%7D%0A%09public void update() %7B%0A%09%09y += 3f;%0A%09%09sprite.setY(y);%0A%09%7D%0A%09public void render(SpriteBatch batch) %7B%0A%09%09sprite.rotate(rotation);%0A%09%09rotation += 0.025f;%0A%09%09%0A%09%09if(360f %3C= rotation) rotation = 0;%0A%09%09sprite.draw(batch);%0A%09%09
 %0A%09
+%7D
 %0A%09pu

Add rotation to player and right position