package com.pqbyte.coherence;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.Actor;

/**
 * The map where the game is played.
 */
public class Map extends Actor {

  private Texture texture;

  public Map(Texture texture, float width, float height) {
    this.texture = texture;
    setBounds(getX(), getY(), width, height);
  }

  @Override
  public void draw(Batch batch, float parentAlpha) {
    batch.draw(texture, getX(), getY(), getWidth(), getHeight());
  }
}

@@ -110,16 +110,251 @@
 .Batch;%0A
+import com.badlogic.gdx.physics.box2d.Body;%0Aimport com.badlogic.gdx.physics.box2d.BodyDef;%0Aimport com.badlogic.gdx.physics.box2d.EdgeShape;%0Aimport com.badlogic.gdx.physics.box2d.FixtureDef;%0Aimport com.badlogic.gdx.physics.box2d.World;%0A
 import c
@@ -497,16 +497,39 @@
 texture;
+%0A  private World world;
 %0A%0A  publ
@@ -577,16 +577,29 @@
 t height
+, World world
 ) %7B%0A    
@@ -622,16 +622,40 @@
 exture;%0A
+    this.world = world;%0A
     setB
@@ -692,16 +692,35 @@
 eight);%0A
+    createWalls();%0A
   %7D%0A%0A  @
@@ -850,11 +850,878 @@
 ());%0A  %7D
+%0A%0A  /**%0A   * Creates the Box2D walls for the map,%0A   * which stop things from escaping the map.%0A   */%0A  private void createWalls() %7B%0A    createWall(0, 0, getWidth(), 0);%0A    createWall(0, getHeight(), getWidth(), getHeight());%0A    createWall(0, 0, 0, getHeight());%0A    createWall(getWidth(), 0, getWidth(), getHeight());%0A  %7D%0A%0A  private void createWall(float x1, float y1, float x2, float y2) %7B%0A    BodyDef def = new BodyDef();%0A    def.type = BodyDef.BodyType.StaticBody;%0A    def.position.set(0, 0);%0A%0A    EdgeShape shape = new EdgeShape();%0A    shape.set(x1, y1, x2, y2);%0A%0A    FixtureDef properties = new FixtureDef();%0A    properties.shape = shape;%0A    properties.filter.categoryBits = Constants.WORLD_ENTITY;%0A    properties.filter.maskBits = Constants.PHYSICS_ENTITY;%0A%0A    Body wall = world.createBody(def);%0A    wall.createFixture(properties);%0A    shape.dispose();%0A  %7D
 %0A%7D%0A

Add Box2D walls to map