|
@@ -11,6 +11,7 @@ import me.hammerle.snuviengine.api.Shader;
|
|
import me.hammerle.snuviscript.code.SnuviParser;
|
|
import me.hammerle.snuviscript.code.SnuviParser;
|
|
import me.hammerle.supersnuvi.entity.Entity;
|
|
import me.hammerle.supersnuvi.entity.Entity;
|
|
import me.hammerle.supersnuvi.entity.EntityBuilder;
|
|
import me.hammerle.supersnuvi.entity.EntityBuilder;
|
|
|
|
+import me.hammerle.supersnuvi.entity.components.ai.PlatformController;
|
|
import me.hammerle.supersnuvi.gamelogic.Level;
|
|
import me.hammerle.supersnuvi.gamelogic.Level;
|
|
import me.hammerle.supersnuvi.gamelogic.StartScreenLevel;
|
|
import me.hammerle.supersnuvi.gamelogic.StartScreenLevel;
|
|
import me.hammerle.supersnuvi.savegame.SimpleConfig;
|
|
import me.hammerle.supersnuvi.savegame.SimpleConfig;
|
|
@@ -41,7 +42,7 @@ public class Game extends Engine
|
|
public static final NullTile FALLBACK_TILE = new NullTile();
|
|
public static final NullTile FALLBACK_TILE = new NullTile();
|
|
|
|
|
|
// tiles
|
|
// tiles
|
|
- private final Tile[] registeredTiles = new Tile[72];
|
|
|
|
|
|
+ private final Tile[] registeredTiles = new Tile[73];
|
|
|
|
|
|
// levels
|
|
// levels
|
|
private Level currentLevel = null;
|
|
private Level currentLevel = null;
|
|
@@ -625,10 +626,12 @@ public class Game extends Engine
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // test interact tile
|
|
|
|
- registeredTiles[70] = new InteractTile(0.5625f, 0.0f, 0.625f, 0.0625f);
|
|
|
|
- // test hit tile
|
|
|
|
- registeredTiles[71] = new HeadHitBlock(0.5625f, 0.0f, 0.625f, 0.0625f);
|
|
|
|
|
|
+ // !-Tile
|
|
|
|
+ registeredTiles[70] = new HeadHitTile(0.5625f, 0.0f, 0.625f, 0.0625f);
|
|
|
|
+ // ?-Tile
|
|
|
|
+ registeredTiles[71] = new HeadHitOnceTile(0.625f, 0.0f, 0.6875f, 0.0625f, 0.6875f, 0.0f, 0.75f, 0.0625f);
|
|
|
|
+ // button
|
|
|
|
+ registeredTiles[72] = new InteractTile(0.75f, 0.0f, 0.8125f, 0.0625f);
|
|
}
|
|
}
|
|
|
|
|
|
public Tile getTile(int id)
|
|
public Tile getTile(int id)
|
|
@@ -714,6 +717,7 @@ public class Game extends Engine
|
|
|
|
|
|
private void addSnuviCommands()
|
|
private void addSnuviCommands()
|
|
{
|
|
{
|
|
|
|
+ snuviParser.registerFunction("level.getname", (sc, in) -> currentLevel.getName());
|
|
snuviParser.registerFunction("level.getwidth", (sc, in) -> (double) currentLevel.getWidth());
|
|
snuviParser.registerFunction("level.getwidth", (sc, in) -> (double) currentLevel.getWidth());
|
|
snuviParser.registerFunction("level.getheight", (sc, in) -> (double) currentLevel.getHeight());
|
|
snuviParser.registerFunction("level.getheight", (sc, in) -> (double) currentLevel.getHeight());
|
|
snuviParser.registerFunction("level.getlayers", (sc, in) -> (double) currentLevel.getData().getLayers());
|
|
snuviParser.registerFunction("level.getlayers", (sc, in) -> (double) currentLevel.getData().getLayers());
|
|
@@ -735,6 +739,11 @@ public class Game extends Engine
|
|
currentLevel.addMessage(in[0].getString(sc));
|
|
currentLevel.addMessage(in[0].getString(sc));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
|
|
+ snuviParser.registerFunction("level.finish", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ currentLevel.finishLevel();
|
|
|
|
+ return Void.TYPE;
|
|
|
|
+ });
|
|
|
|
|
|
snuviParser.registerFunction("tile.totilecoord", (sc, in) -> (double) Utils.toBlock(in[0].getFloat(sc)));
|
|
snuviParser.registerFunction("tile.totilecoord", (sc, in) -> (double) Utils.toBlock(in[0].getFloat(sc)));
|
|
snuviParser.registerFunction("tile.tolevelcoord", (sc, in) -> (double) Utils.toCoord(in[0].getInt(sc)));
|
|
snuviParser.registerFunction("tile.tolevelcoord", (sc, in) -> (double) Utils.toCoord(in[0].getInt(sc)));
|
|
@@ -785,5 +794,25 @@ public class Game extends Engine
|
|
}
|
|
}
|
|
return ent;
|
|
return ent;
|
|
});
|
|
});
|
|
|
|
+ snuviParser.registerFunction("entity.remove", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ Entity ent = (Entity) in[0].get(sc);
|
|
|
|
+ // move entity out of world so it is removed
|
|
|
|
+ ent.setPosition(0.0f, Float.MAX_VALUE * 0.5f);
|
|
|
|
+ return Void.TYPE;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ snuviParser.registerFunction("platform.spawn", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ Entity ent = EntityBuilder.buildPlatform(currentLevel, in[0].getInt(sc), in[1].getFloat(sc), in[2].getInt(sc));
|
|
|
|
+ currentLevel.spawnEntity(ent);
|
|
|
|
+ return ent;
|
|
|
|
+ });
|
|
|
|
+ snuviParser.registerFunction("platform.addmove", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ PlatformController controller = (PlatformController) ((Entity) in[0].get(sc)).getController();
|
|
|
|
+ controller.addMoveData(in[1].getFloat(sc), in[2].getFloat(sc), in[3].getFloat(sc), in[4].getFloat(sc), in[5].getInt(sc));
|
|
|
|
+ return Void.TYPE;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|