Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Player {
- private double x;
- private double y;
- public static int r;
- private double hp;
- private int ra;
- public static int damage;
- public static int skillz;
- private int speed;
- private Color color1;
- private Color color2;
- public static int xp;
- public int lvl;
- public String lvle;
- public static boolean up;
- public static boolean down;
- public static boolean left;
- public static boolean rignt;
- private double dy;
- private double dx;
- public static boolean isFiring;
- private double alpha;
- //private double ckill;
- public double getX() {
- return x;
- }
- public double getY() {
- return y;
- }
- public int getR() {
- return r;
- }
- public Player() {
- x = GamePanel.WIDTH / 2;
- y = GamePanel.HEIGHT / 2;
- r = 10;
- hp = 10;
- xp = 0;
- damage = 1;
- lvl = 1;
- lvle = ""+lvl;
- String sk = ""+skillz;
- ra = 15;
- skillz = 1;
- //ckill = 0;
- speed = 5;
- dx = 0;
- dy = 0;
- color1 = Color.WHITE;
- color2 = Color.YELLOW;
- up = false;
- down = false;
- left = false;
- rignt = false;
- isFiring = false;
- }
- public void update() {
- if (up && y > r) {
- dy = -speed;
- }
- if (down && y < GamePanel.HEIGHT - r) {
- dy = speed;
- }
- if (left && x > r) {
- dx = -speed;
- }
- if (rignt && x < GamePanel.WIDTH - r) {
- dx = speed;
- }
- if (up && left || up && rignt || down && left || down && rignt) {
- double angle = Math.toRadians(45);
- dy = dy * Math.sin(angle);
- dx = dx * Math.cos(angle);
- }
- y += dy;
- x += dx;
- dy = 0;
- dx = 0;
- if (isFiring) {
- GamePanel.bullets.add(new Bullet());
- }
- if(GamePanel.hp >= 3) {
- lvl++;
- r += 3;
- skillz += 1;
- GamePanel.hp = 0;
- lvle = "" + lvl;
- damage += 1/5;
- }
- if (lvl <= 2){
- Color color2 = Color.RED;
- }
- }
- public static void skill(){
- if (skillz >= 1){
- damage +=5;
- //speed += 5;
- r += 5;
- skillz -= 1;
- }
- }
- public void draw(Graphics2D g) {
- String sk = ""+skillz;
- g.drawString(sk,30,30);
- g.setColor(Color.DARK_GRAY.darker());
- g.setStroke(new BasicStroke(60));
- g.setColor(color2);
- g.fillOval(10, 10, 2 * ra, 2 * ra);
- g.setColor(Color.BLACK);
- g.drawString(lvle, 22, 30);
- g.setStroke(new BasicStroke(5));
- g.setColor(color1);
- g.fillOval((int) (x - r), (int) (y - r), 2 * r, 2 * r);
- g.setStroke(new BasicStroke(3));
- g.setColor(color1.darker());
- g.drawOval((int) (x - r), (int) (y - r), 2 * r, 2 * r);
- g.setStroke(new BasicStroke(1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement