Add support for map objects
This commit is contained in:
@@ -47,6 +47,10 @@ public abstract class BaseMapHandler implements MapHandler {
|
||||
player.attack();
|
||||
}
|
||||
|
||||
if(input.isKeyPressed(Key.KEY_ENTER)) {
|
||||
player.interact();
|
||||
}
|
||||
|
||||
if(input.isKeyPressed(Key.KEY_LEFT_CONTROL)) {
|
||||
if(input.isKeyPressed(Key.KEY_DOWN)) {
|
||||
player.setFaceDirection(Direction.DOWN);
|
||||
@@ -81,4 +85,11 @@ public abstract class BaseMapHandler implements MapHandler {
|
||||
mainLayer.addEntity(enemy);
|
||||
return enemy;
|
||||
}
|
||||
|
||||
public MapObject object(int x, int y, @NonNull String id) {
|
||||
var object = new MapObject(context, runner.getMapObjectDAO().find(id));
|
||||
object.setCoordinates(x, y);
|
||||
mainLayer.addEntity(object);
|
||||
return object;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user