From 64e50c3c2e54d5e0305012b363e93b024a316ade Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 14 Jan 2014 20:32:22 +0200 Subject: [PATCH] Add enemy object --- src/com/annimon/influencexxii/Enemy.java | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/com/annimon/influencexxii/Enemy.java diff --git a/src/com/annimon/influencexxii/Enemy.java b/src/com/annimon/influencexxii/Enemy.java new file mode 100644 index 0000000..0d33d88 --- /dev/null +++ b/src/com/annimon/influencexxii/Enemy.java @@ -0,0 +1,37 @@ +package com.annimon.influencexxii; + +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; + +/** + * Enemy object + * @author aNNiMON + */ +public class Enemy { + + private int x, y, size; + private int dir; + private Color color; + + public Enemy(int x, int y, int size) { + this(x, y, size, 5, Color.RED); + } + + public Enemy(int x, int y, int size, int dir, Color color) { + this.x = x; + this.y = y; + this.size = size; + this.dir = dir; + this.color = color; + } + + public boolean isCollide(int tx, int ty) { + return ( ((tx >= x) && (tx <= x + size)) + && ((ty >= y) && (ty <= y + size)) ); + } + + public void draw(ShapeRenderer renderer) { + renderer.setColor(color); + renderer.rect(x, y, size, size); + } +} \ No newline at end of file