Change enemy internal direction to Vector2
This commit is contained in:
parent
487cdd274c
commit
b0083f0e58
@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
public class EnemiesController {
|
public class EnemiesController {
|
||||||
@ -38,6 +39,6 @@ public class EnemiesController {
|
|||||||
int x = MathUtils.random(screenWidth - size);
|
int x = MathUtils.random(screenWidth - size);
|
||||||
int y = MathUtils.random(screenHeight - size);
|
int y = MathUtils.random(screenHeight - size);
|
||||||
Color color = DrawUtils.random2Color(0x43, 0xff);
|
Color color = DrawUtils.random2Color(0x43, 0xff);
|
||||||
return new Enemy(x, y, size, 5, color);
|
return new Enemy(x, y, size, new Vector2(), color);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package com.annimon.influencexxii;
|
|||||||
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.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enemy object
|
* Enemy object
|
||||||
@ -11,14 +12,14 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
public class Enemy {
|
public class Enemy {
|
||||||
|
|
||||||
private Rectangle rect;
|
private Rectangle rect;
|
||||||
private int dir;
|
private Vector2 dir;
|
||||||
private Color color;
|
private Color color;
|
||||||
|
|
||||||
public Enemy(int x, int y, int size) {
|
public Enemy(int x, int y, int size) {
|
||||||
this(x, y, size, 5, Color.RED);
|
this(x, y, size, new Vector2(), Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enemy(int x, int y, int size, int dir, Color color) {
|
public Enemy(int x, int y, int size, Vector2 dir, Color color) {
|
||||||
rect = new Rectangle(x, y, size, size);
|
rect = new Rectangle(x, y, size, size);
|
||||||
this.dir = dir;
|
this.dir = dir;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
Loading…
Reference in New Issue
Block a user