From b0083f0e58c5a0b2a532fef8893d22f9fc76319a Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 14 Jan 2014 22:13:54 +0200 Subject: [PATCH] Change enemy internal direction to Vector2 --- src/com/annimon/influencexxii/EnemiesController.java | 3 ++- src/com/annimon/influencexxii/Enemy.java | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/annimon/influencexxii/EnemiesController.java b/src/com/annimon/influencexxii/EnemiesController.java index 7dd114c..18ef2ce 100644 --- a/src/com/annimon/influencexxii/EnemiesController.java +++ b/src/com/annimon/influencexxii/EnemiesController.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; public class EnemiesController { @@ -38,6 +39,6 @@ public class EnemiesController { int x = MathUtils.random(screenWidth - size); int y = MathUtils.random(screenHeight - size); Color color = DrawUtils.random2Color(0x43, 0xff); - return new Enemy(x, y, size, 5, color); + return new Enemy(x, y, size, new Vector2(), color); } } \ No newline at end of file diff --git a/src/com/annimon/influencexxii/Enemy.java b/src/com/annimon/influencexxii/Enemy.java index ab0dffd..e6d49a3 100644 --- a/src/com/annimon/influencexxii/Enemy.java +++ b/src/com/annimon/influencexxii/Enemy.java @@ -3,6 +3,7 @@ package com.annimon.influencexxii; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Vector2; /** * Enemy object @@ -11,14 +12,14 @@ import com.badlogic.gdx.math.Rectangle; public class Enemy { private Rectangle rect; - private int dir; + private Vector2 dir; private Color color; 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); this.dir = dir; this.color = color;