package stray.ai;

import stray.Main;
import stray.entity.Entity;

public class AIDumbEnemy extends BaseAI {

	public AIDumbEnemy(Entity e) {
		super(e);
	}

	/**
	 * false = left
	 */
	boolean direction = Main.getRandom().nextBoolean();

	@Override
	public void tickUpdate() {

	}

	@Override
	public void renderUpdate() {
		if (e.getBlockCollidingLeft() != null && e.getBlockCollidingRight() != null) return;

		if (direction) {
			e.moveRight();
		} else {
			e.moveLeft();
		}
		if (e.getBlockCollidingLeft() != null && !direction) {
			direction = true;
		} else if (e.getBlockCollidingRight() != null && direction) {
			direction = false;
		}
	}

}

@@ -10,17 +10,19 @@
 tray.ai;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -32,16 +32,17 @@
 ay.Main;
+%0D
 %0Aimport 
@@ -61,17 +61,19 @@
 .Entity;
-%0A
+%0D%0A%0D
 %0Apublic 
@@ -106,17 +106,19 @@
 BaseAI %7B
-%0A
+%0D%0A%0D
 %0A%09public
@@ -141,16 +141,17 @@
 ity e) %7B
+%0D
 %0A%09%09super
@@ -158,17 +158,21 @@
 (e);
+%0D
 %0A%09%7D
-%0A
+%0D%0A%0D
 %0A%09/**
+%0D
 %0A%09 *
@@ -188,13 +188,15 @@
 left
+%0D
 %0A%09 */
+%0D
 %0A%09bo
@@ -244,17 +244,19 @@
 olean();
-%0A
+%0D%0A%0D
 %0A%09@Overr
@@ -250,32 +250,33 @@
 );%0D%0A%0D%0A%09@Override
+%0D
 %0A%09public void ti
@@ -291,13 +291,17 @@
 () %7B
-%0A%0A%09%7D%0A
+%0D%0A%0D%0A%09%7D%0D%0A%0D
 %0A%09@O
@@ -307,16 +307,17 @@
 Override
+%0D
 %0A%09public
@@ -338,16 +338,17 @@
 date() %7B
+%0D
 %0A%09%09if (e
@@ -422,17 +422,29 @@
 ull)
- 
+%7B%0D%0A%09%09%09
 return;
-%0A
+%0D%0A%09%09%7D%0D%0A%0D
 %0A%09%09i
@@ -454,24 +454,25 @@
 direction) %7B
+%0D
 %0A%09%09%09e.moveRi
@@ -473,24 +473,25 @@
 moveRight();
+%0D
 %0A%09%09%7D else %7B%0A
@@ -489,16 +489,17 @@
 %7D else %7B
+%0D
 %0A%09%09%09e.mo
@@ -511,18 +511,42 @@
 t();
+%0D
 %0A%09%09%7D
-%0A%09%09if 
+%0D%0A%09%09%0D%0A%09%09if(direction)%7B%0D%0A%09%09%09if
 (e.g
@@ -553,35 +553,36 @@
 etBlockColliding
-Lef
+Righ
 t() != null && !
@@ -580,29 +580,10 @@
 null
+)
  
-&& !direction) %7B%0A%09%09%09
 dire
@@ -594,26 +594,31 @@
 n = 
-tru
+fals
 e;
+%0D
 %0A%09%09%7D
- 
 else
- 
+%7B%0D%0A%09%09%09
 if
- 
 (e.g
@@ -625,36 +625,35 @@
 etBlockColliding
-Righ
+Lef
 t() != null && d
@@ -651,28 +651,10 @@
 null
+)
  
-&& direction) %7B%0A%09%09%09
 dire
@@ -665,21 +665,25 @@
 n = 
-fals
+tru
 e;
+%0D
 %0A%09%09%7D
+%0D
 %0A%09%7D
-%0A
+%0D%0A%0D
 %0A%7D
+%0D
 %0A

Restructured if statements