Reorganized all necessary things into a Level wrapper class

master
Edward Peterson 9 years ago
parent 64ffe0ff09
commit 3f2dbca0f4

@ -1,4 +1,5 @@
#version 410 core #version 410 core
#define M_PI 3.1415926535897932384626433832795
//SpriteBatch will use texture unit 0 //SpriteBatch will use texture unit 0
uniform sampler2D u_texture; uniform sampler2D u_texture;
uniform vec2 u_screenResolution; uniform vec2 u_screenResolution;
@ -38,7 +39,7 @@ void main() {
float dis2Light2 = (1-(min(dis2Light/(disFull * u_lightIntensity[i]), 1))); float dis2Light2 = (1-(min(dis2Light/(disFull * u_lightIntensity[i]), 1)));
brightest = brightest + dis2Light2 - brightest * dis2Light2; brightest = brightest + dis2Light2 - brightest * dis2Light2;
} }
texColor.rgb = texColor.rgb * (pow(brightest, 10)); texColor.rgb = texColor.rgb * (sin(pow(brightest, 10) * M_PI / 2));
//final color //final color
gl_FragColor = texColor * vColor; gl_FragColor = texColor * vColor;
} }

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-up" width="50" height="50" tilewidth="16" tileheight="16" nextobjectid="163"> <map version="1.0" orientation="orthogonal" renderorder="right-up" width="50" height="50" tilewidth="16" tileheight="16" nextobjectid="166">
<tileset firstgid="1" name="env" tilewidth="16" tileheight="16" tilecount="64" columns="8"> <tileset firstgid="1" name="env" tilewidth="16" tileheight="16" tilecount="64" columns="8">
<image source="env.png" width="128" height="128"/> <image source="env.png" width="128" height="128"/>
</tileset> </tileset>
@ -111,6 +111,9 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data> </data>
</layer> </layer>
<objectgroup name="secretRoom1Spawn">
<object id="163" x="704" y="32" width="96" height="144"/>
</objectgroup>
<objectgroup name="collisions"> <objectgroup name="collisions">
<object id="2" x="112" y="272" width="240" height="40"/> <object id="2" x="112" y="272" width="240" height="40"/>
<object id="3" x="288" y="256" width="144" height="40"/> <object id="3" x="288" y="256" width="144" height="40"/>
@ -356,5 +359,15 @@
<property name="type" value="torch"/> <property name="type" value="torch"/>
</properties> </properties>
</object> </object>
<object id="164" x="752" y="128" width="16" height="16">
<properties>
<property name="type" value="box"/>
</properties>
</object>
<object id="165" x="784" y="768" width="16" height="16">
<properties>
<property name="type" value="box"/>
</properties>
</object>
</objectgroup> </objectgroup>
</map> </map>

@ -26,116 +26,29 @@ import com.toasted.chuck.entities.EntityTorch;
public class ChuckGame extends ApplicationAdapter implements InputProcessor{ public class ChuckGame extends ApplicationAdapter implements InputProcessor{
Graphics graphics; Graphics graphics;
EntityPlayer player;
ArrayList<Entity> entities = new ArrayList<Entity>();
Comparator<Entity> zSorter;
public static TiledMap tiledMap;
OrthogonalTiledMapRenderer tmRenderer;
ArrayList<Rectangle> collisions = new ArrayList<Rectangle>();
ArrayList<Light> lights = new ArrayList<Light>();
boolean testLightFade = false; boolean testLightFade = false;
public static HashMap<Rectangle, MapObject> collisionLookupTable = new HashMap<Rectangle, MapObject>(); Level level;
// public static ArrayList<String> hiddenLayers = new ArrayList<String>();
@Override
public void create () { public void create () {
Gdx.input.setInputProcessor(this); Gdx.input.setInputProcessor(this);
graphics = new Graphics(); graphics = new Graphics();
player = new EntityPlayer(); level = new Level("testmap.tmx", graphics);
entities.add(new EntityBox(20, 20));
entities.add(new EntityBox(100, 100));
entities.add(player);
zSorter = new Comparator<Entity>(){
public int compare(Entity arg0, Entity arg1) {
return (int) Math.signum(arg1.getY() - arg0.getY());
}
};
tiledMap = new TmxMapLoader().load("testmap.tmx");
tmRenderer = new OrthogonalTiledMapRenderer(tiledMap, graphics.getBatch());
lights.add(player.getLight());
for(MapLayer ml: tiledMap.getLayers()){
if(ml.getName().contains("secret")){
// hiddenLayers.add(ml.getName());
ml.setVisible(false);
}
}
MapLayer ml = tiledMap.getLayers().get("collisions");
for(MapObject o: ml.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
collisions.add(r);
collisionLookupTable.put(r, o);
} }
MapLayer lightLayer = tiledMap.getLayers().get("staticLights");
Vector2 t = new Vector2();
for(MapObject o: lightLayer.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
t = new Rectangle(rmo.getRectangle()).getCenter(t);
lights.add(new Light(t.x, t.y, Light.VAL_TORCH));
}
MapLayer objectLayer = tiledMap.getLayers().get("objectSpawn");
for(MapObject o: objectLayer.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
t = r.getCenter(t);
// System.out.println(o.getProperties().get("type"));
if(o.getProperties().get("type").equals("torch")){
EntityTorch torch = new EntityTorch(t.x - r.getWidth() / 2, t.y - r.getHeight() / 2);
spawnEntity(torch);
}
}
}
@Override @Override
public void render () { public void render () {
level.update(Gdx.graphics.getDeltaTime());
for(Entity e: entities){
e.update(Gdx.graphics.getDeltaTime(), entities, collisions);
}
Collections.sort(entities, zSorter);
graphics.cam.position.x = player.getCenterX();
graphics.cam.position.y = player.getCenterY();
graphics.cam.update();
if(testLightFade){
graphics.lightValueMultiplier -= Gdx.graphics.getDeltaTime();
graphics.lightValueMultiplier = Math.max(0, graphics.lightValueMultiplier);
}
graphics.prepare();
graphics.passLightsToShader(lights);
Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
level.draw(graphics);
tmRenderer.setView(graphics.cam);
tmRenderer.render();
graphics.startSprite();
for(Entity e: entities){
e.draw(graphics);
}
graphics.endSprite();
// System.out.println("FPS:" + Gdx.graphics.getFramesPerSecond()); // System.out.println("FPS:" + Gdx.graphics.getFramesPerSecond());
} }
public void spawnEntity(Entity e){
if(e instanceof LightEmitter){
lights.add(((LightEmitter) e).getLight());
}
entities.add(e);
}
@Override @Override
public void dispose () { public void dispose () {
@ -143,13 +56,13 @@ public class ChuckGame extends ApplicationAdapter implements InputProcessor{
@Override @Override
public boolean keyDown(int keycode) { public boolean keyDown(int keycode) {
player.getController().acceptEvent(keycode, true, player, entities, collisions); level.getPlayer().getController().acceptEvent(keycode, true, level);
return false; return false;
} }
@Override @Override
public boolean keyUp(int keycode) { public boolean keyUp(int keycode) {
player.getController().acceptEvent(keycode, false, player, entities, collisions); level.getPlayer().getController().acceptEvent(keycode, false, level);
switch(keycode){ switch(keycode){
case Keys.F: case Keys.F:
testLightFade = true; testLightFade = true;
@ -157,40 +70,22 @@ public class ChuckGame extends ApplicationAdapter implements InputProcessor{
} }
return false; return false;
} }
@Override
public boolean keyTyped(char character) { public boolean keyTyped(char character) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) { public boolean touchDown(int screenX, int screenY, int pointer, int button) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) { public boolean touchUp(int screenX, int screenY, int pointer, int button) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) { public boolean touchDragged(int screenX, int screenY, int pointer) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean mouseMoved(int screenX, int screenY) { public boolean mouseMoved(int screenX, int screenY) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean scrolled(int amount) { public boolean scrolled(int amount) {
// TODO Auto-generated method stub
return false; return false;
} }
} }

@ -6,5 +6,5 @@ import com.badlogic.gdx.math.Rectangle;
import com.toasted.chuck.entities.Entity; import com.toasted.chuck.entities.Entity;
public interface EntityController { public interface EntityController {
public void acceptEvent(int keycode, boolean newState, Entity owner, ArrayList<Entity> entities, ArrayList<Rectangle> collisions); public void acceptEvent(int keycode, boolean newState, Level world);
} }

@ -0,0 +1,206 @@
package com.toasted.chuck;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import com.badlogic.gdx.maps.MapLayer;
import com.badlogic.gdx.maps.MapObject;
import com.badlogic.gdx.maps.MapProperties;
import com.badlogic.gdx.maps.objects.RectangleMapObject;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.toasted.chuck.entities.Entity;
import com.toasted.chuck.entities.EntityBox;
import com.toasted.chuck.entities.EntityPlayer;
import com.toasted.chuck.entities.EntityTorch;
public class Level {
private EntityPlayer player;
private ArrayList<Entity> entities = new ArrayList<Entity>();
private Comparator<Entity> zSorter;
private TiledMap tiledMap;
private OrthogonalTiledMapRenderer tmRenderer;
private ArrayList<Rectangle> collisions = new ArrayList<Rectangle>();
private ArrayList<Light> lights = new ArrayList<Light>();
private HashMap<Rectangle, MapObject> collisionLookupTable = new HashMap<Rectangle, MapObject>();
private ArrayList<SecretRoom> secretRooms = new ArrayList<SecretRoom>();
public Level(String filename, Graphics graphics){
tiledMap = new TmxMapLoader().load("testmap.tmx");
tmRenderer = new OrthogonalTiledMapRenderer(tiledMap, graphics.getBatch());
zSorter = new Comparator<Entity>(){
public int compare(Entity arg0, Entity arg1) {
return (int) Math.signum(arg1.getY() - arg0.getY());
}
};
player = new EntityPlayer();
spawnEntity(player);
buildLevel();
}
private void buildLevel(){
for(MapLayer ml: tiledMap.getLayers()){
if(ml.getName().contains("secret")){
// hiddenLayers.add(ml.getName());
MapLayer spawner = tiledMap.getLayers().get(ml.getName() + "Spawn");
SecretRoom room = new SecretRoom();
room.roomName = ml.getName();
if(spawner != null){
for(MapObject o: spawner.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
room.entityHiders.add(r);
}
System.out.println(room.entityHiders.size() + " hiders added");
}
secretRooms.add(room);
ml.setVisible(false);
}
}
MapLayer ml = tiledMap.getLayers().get("collisions");
for(MapObject o: ml.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
collisions.add(r);
collisionLookupTable.put(r, o);
}
MapLayer lightLayer = tiledMap.getLayers().get("staticLights");
Vector2 t = new Vector2();
for(MapObject o: lightLayer.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
t = new Rectangle(rmo.getRectangle()).getCenter(t);
lights.add(new Light(t.x, t.y, Light.VAL_TORCH));
}
MapLayer objectLayer = tiledMap.getLayers().get("objectSpawn");
for(MapObject o: objectLayer.getObjects()){
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
t = r.getCenter(t);
boolean hidden = false;
for(SecretRoom secretRoom: secretRooms){
for(Rectangle hider: secretRoom.entityHiders){
if(hider.overlaps(r)){
hidden = true;
buildEntity(o, secretRoom.toSpawnOnReveal);
}
}
}
if(hidden) continue;
buildEntity(o, null);
}
}
public void revealSecretRoom(String name){
MapLayer layer = tiledMap.getLayers().get(name);
if(layer != null){
layer.setVisible(true);
} else {
System.err.println("Failed to reveal room: " + name);
}
for(SecretRoom sr: secretRooms){
if(sr.roomName.equals(name)){
for(Entity e: sr.toSpawnOnReveal){
spawnEntity(e);
}
sr.toSpawnOnReveal.clear();
}
}
}
private void buildEntity(MapObject o, ArrayList<Entity> listToAdd){
if(o.getProperties().get("type") == null) {
System.err.println("Unclassified Entity found");
return;
}
RectangleMapObject rmo = (RectangleMapObject) o;
Rectangle r = new Rectangle(rmo.getRectangle());
Vector2 t = new Vector2();
t = r.getCenter(t);
Entity newEntity = null;
if(o.getProperties().get("type").equals("torch")){
newEntity = new EntityTorch(t.x - r.getWidth() / 2, t.y - r.getHeight() / 2);
}
if(o.getProperties().get("type").equals("box")){
newEntity = new EntityBox(t.x - r.getWidth() / 2, t.y - r.getHeight() / 2);
}
if(listToAdd == null){
spawnEntity(newEntity);
} else {
listToAdd.add(newEntity);
}
}
public void spawnEntity(Entity e){
if(e instanceof LightEmitter){
lights.add(((LightEmitter) e).getLight());
}
entities.add(e);
}
public void update(float delta){
for(int i = 0;i < entities.size();i++){
Entity e = entities.get(i);
e.update(delta, this);
}
Collections.sort(entities, zSorter);
}
public void draw(Graphics graphics){
graphics.cam.position.x = player.getCenterX();
graphics.cam.position.y = player.getCenterY();
graphics.cam.update();
//
// if(testLightFade){
// graphics.lightValueMultiplier -= Gdx.graphics.getDeltaTime();
// graphics.lightValueMultiplier = Math.max(0, graphics.lightValueMultiplier);
// }
graphics.prepare();
graphics.passLightsToShader(lights);
tmRenderer.setView(graphics.cam);
tmRenderer.render();
graphics.startSprite();
for(Entity e: entities){
e.draw(graphics);
}
graphics.endSprite();
}
public EntityPlayer getPlayer(){
return player;
}
public boolean isCollisionBoxDestructable(Rectangle r){
MapObject mo = collisionLookupTable.get(r);
if(mo == null) return false;
return mo.getProperties().containsKey("destructable");
}
public MapProperties getCollisionProperties(Rectangle r){
MapObject mo = collisionLookupTable.get(r);
if(mo == null) throw new NullPointerException("This rectangle does not belong to the collision lookup table");
return mo.getProperties();
}
public ArrayList<Rectangle> getCollisions(){
return collisions;
}
public ArrayList<Entity> getEntities(){
return entities;
}
}

@ -5,7 +5,7 @@ import com.badlogic.gdx.math.Vector2;
public class Light { public class Light {
public final static float VAL_TORCH = .4f; public final static float VAL_TORCH = .4f;
public final static float VAL_PLAYER = .9f; public final static float VAL_PLAYER = .9f;
public final static float VAL_AMBIENT = 0f; public final static float VAL_AMBIENT = .25f;
private static Vector2 tmp = new Vector2(); private static Vector2 tmp = new Vector2();
private Vector2 position; private Vector2 position;
private float intensity = 1; private float intensity = 1;

@ -0,0 +1,12 @@
package com.toasted.chuck;
import java.util.ArrayList;
import com.badlogic.gdx.math.Rectangle;
import com.toasted.chuck.entities.Entity;
public class SecretRoom {
public ArrayList<Rectangle> entityHiders = new ArrayList<Rectangle>();
public ArrayList<Entity> toSpawnOnReveal = new ArrayList<Entity>();
String roomName;
}

@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.toasted.chuck.EntityController; import com.toasted.chuck.EntityController;
import com.toasted.chuck.Graphics; import com.toasted.chuck.Graphics;
import com.toasted.chuck.Level;
public abstract class Entity { public abstract class Entity {
protected Vector2 position = new Vector2(); protected Vector2 position = new Vector2();
@ -19,7 +20,7 @@ public abstract class Entity {
public Entity(){ public Entity(){
} }
public abstract void update(float delta, ArrayList<Entity> entities, ArrayList<Rectangle> collisions); public abstract void update(float delta, Level lvl);
protected Rectangle doCollisions(float delta, ArrayList<Rectangle> collisions){ protected Rectangle doCollisions(float delta, ArrayList<Rectangle> collisions){
Rectangle collidedWith = null; Rectangle collidedWith = null;
position.x += velocity.x * delta; position.x += velocity.x * delta;

@ -1,12 +1,11 @@
package com.toasted.chuck.entities; package com.toasted.chuck.entities;
import java.util.ArrayList;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.maps.MapLayer; import com.badlogic.gdx.maps.MapProperties;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.toasted.chuck.ChuckGame; import com.toasted.chuck.ChuckGame;
import com.toasted.chuck.Graphics; import com.toasted.chuck.Graphics;
import com.toasted.chuck.Level;
public class EntityBox extends Entity{ public class EntityBox extends Entity{
float decel = 25; float decel = 25;
@ -20,21 +19,17 @@ public class EntityBox extends Entity{
collision = new Rectangle(x, y, 16, 16); collision = new Rectangle(x, y, 16, 16);
weight = 1; weight = 1;
} }
public void update(float delta, ArrayList<Entity> entities, ArrayList<Rectangle> collisions) { public void update(float delta, Level lvl) {
flyLength -= delta; flyLength -= delta;
if(flyLength <= 0) if(flyLength <= 0)
velocity.mulAdd(velocity, -delta * decel); velocity.mulAdd(velocity, -delta * decel);
Rectangle r = doCollisions(delta, collisions); Rectangle r = doCollisions(delta, lvl.getCollisions());
if(r != null){ if(r != null){
if(ChuckGame.collisionLookupTable.get(r).getProperties().containsKey("destructable") && weight > .75f){ if(lvl.isCollisionBoxDestructable(r) && weight > .75f){
String layerOpened = (String) ChuckGame.collisionLookupTable.get(r).getProperties().get("destructable"); MapProperties mp = lvl.getCollisionProperties(r);
collisions.remove(r); String layerOpened = (String) mp.get("destructable");
MapLayer layer = ChuckGame.tiledMap.getLayers().get(layerOpened); lvl.getCollisions().remove(r);
if(layer != null){ lvl.revealSecretRoom(layerOpened);
layer.setVisible(true);
} else {
System.err.println("Woah, no layer?");
}
} }
} }
} }

@ -2,7 +2,6 @@ package com.toasted.chuck.entities;
import java.util.ArrayList; import java.util.ArrayList;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
@ -10,6 +9,7 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.toasted.chuck.EntityController; import com.toasted.chuck.EntityController;
import com.toasted.chuck.Graphics; import com.toasted.chuck.Graphics;
import com.toasted.chuck.Level;
import com.toasted.chuck.Light; import com.toasted.chuck.Light;
import com.toasted.chuck.LightEmitter; import com.toasted.chuck.LightEmitter;
@ -36,14 +36,14 @@ public class EntityPlayer extends Entity implements LightEmitter{
illuminator = new Light(position.x + collision.width / 2, position.y + collision.height / 2, Light.VAL_PLAYER); illuminator = new Light(position.x + collision.width / 2, position.y + collision.height / 2, Light.VAL_PLAYER);
controller = new EntityController(){ controller = new EntityController(){
public void acceptEvent(int keycode, boolean newState, Entity owner, ArrayList<Entity> entities, ArrayList<Rectangle> collisions) { public void acceptEvent(int keycode, boolean newState, Level lvl) {
if(newState){ if(newState){
switch(keycode){ switch(keycode){
case Keys.SPACE: case Keys.SPACE:
if(holding == null) if(holding == null)
for(Entity e: entities){ for(Entity e: lvl.getEntities()){
if(e.collision.overlaps(collision) && e.isChuckable){ if(e.collision.overlaps(collision) && e.isChuckable){
holding = e; holding = e;
holding.shouldDrawSelf = false; holding.shouldDrawSelf = false;
@ -68,7 +68,7 @@ public class EntityPlayer extends Entity implements LightEmitter{
boxCollision.x += getDirectionalVector().x * 16; boxCollision.x += getDirectionalVector().x * 16;
boxCollision.y += getDirectionalVector().y * 16; boxCollision.y += getDirectionalVector().y * 16;
boolean collides = false; boolean collides = false;
for(Rectangle r: collisions){ for(Rectangle r: lvl.getCollisions()){
if(r.overlaps(boxCollision)){ if(r.overlaps(boxCollision)){
//can't place it here //can't place it here
collides = true; collides = true;
@ -128,7 +128,7 @@ public class EntityPlayer extends Entity implements LightEmitter{
return -1; return -1;
} }
private void doControls(ArrayList<Entity> entities){ private void doControls(){
for(int i = 0;i < 4;i++){ for(int i = 0;i < 4;i++){
switch(i){ switch(i){
case 0: //UP case 0: //UP
@ -162,15 +162,15 @@ public class EntityPlayer extends Entity implements LightEmitter{
} }
} }
} }
public void update(float delta, ArrayList<Entity> entities, ArrayList<Rectangle> collisions){ public void update(float delta, Level lvl){
//test array based controls //test array based controls
doControls(entities); doControls();
doCollisions(delta, collisions); doCollisions(delta, lvl.getCollisions());
if(holding != null){ if(holding != null){

@ -1,11 +1,9 @@
package com.toasted.chuck.entities; package com.toasted.chuck.entities;
import java.util.ArrayList;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.toasted.chuck.Graphics; import com.toasted.chuck.Graphics;
import com.toasted.chuck.Level;
import com.toasted.chuck.Light; import com.toasted.chuck.Light;
import com.toasted.chuck.LightEmitter; import com.toasted.chuck.LightEmitter;
@ -24,8 +22,8 @@ public class EntityTorch extends EntityBox implements LightEmitter{
} }
@Override @Override
public void update(float delta, ArrayList<Entity> entities, ArrayList<Rectangle> collisions) { public void update(float delta, Level lvl) {
super.update(delta, entities, collisions); super.update(delta, lvl);
emitter.getPosition().set(position).add(collision.width / 2, 3 * collision.height / 4); emitter.getPosition().set(position).add(collision.width / 2, 3 * collision.height / 4);
} }

Loading…
Cancel
Save