4matting
This commit is contained in:
parent
fd6b9ee8dd
commit
8be7c18d4f
17
src/Game.hx
17
src/Game.hx
@ -1,23 +1,19 @@
|
|||||||
import h2d.Layers;
|
import h2d.Layers;
|
||||||
import h2d.Console;
|
import h2d.Console;
|
||||||
import h3d.Vector4;
|
import h3d.Vector4;
|
||||||
|
|
||||||
import scene.TitleScene;
|
import scene.TitleScene;
|
||||||
import scene.WorldMapScene;
|
import scene.WorldMapScene;
|
||||||
import scene.GameScene;
|
import scene.GameScene;
|
||||||
import event.EventBus;
|
import event.EventBus;
|
||||||
import event.ChangeSceneEvent;
|
import event.ChangeSceneEvent;
|
||||||
|
|
||||||
import Const;
|
import Const;
|
||||||
import dialogue.DialogueBox;
|
import dialogue.DialogueBox;
|
||||||
import dialogue.DialogueManager;
|
import dialogue.DialogueManager;
|
||||||
|
|
||||||
import dialogue.event.LineShown;
|
import dialogue.event.LineShown;
|
||||||
import dialogue.event.OptionsShown;
|
import dialogue.event.OptionsShown;
|
||||||
import dialogue.event.OptionSelected;
|
import dialogue.event.OptionSelected;
|
||||||
import dialogue.event.DialogueComplete;
|
import dialogue.event.DialogueComplete;
|
||||||
import dialogue.event.NextLine;
|
import dialogue.event.NextLine;
|
||||||
|
|
||||||
import dialogue.command.OpenRoomCommand;
|
import dialogue.command.OpenRoomCommand;
|
||||||
|
|
||||||
@:uiComp("game-container")
|
@:uiComp("game-container")
|
||||||
@ -41,11 +37,14 @@ class Game extends hxd.App {
|
|||||||
public var dialogueManager:DialogueManager;
|
public var dialogueManager:DialogueManager;
|
||||||
|
|
||||||
public var globalEventBus:EventBus;
|
public var globalEventBus:EventBus;
|
||||||
|
|
||||||
public static var current:Game; // Current Game (singleton)
|
public static var current:Game; // Current Game (singleton)
|
||||||
|
|
||||||
var layer:Layers;
|
var layer:Layers;
|
||||||
|
|
||||||
public var root:GameContainer;
|
public var root:GameContainer;
|
||||||
public var console:Console;
|
public var console:Console;
|
||||||
|
|
||||||
var style = null;
|
var style = null;
|
||||||
|
|
||||||
public static var loader = new tiled.Tiled();
|
public static var loader = new tiled.Tiled();
|
||||||
@ -86,14 +85,8 @@ class Game extends hxd.App {
|
|||||||
|
|
||||||
dialogueManager = new DialogueManager(globalEventBus);
|
dialogueManager = new DialogueManager(globalEventBus);
|
||||||
|
|
||||||
var yarnText = [
|
var yarnText = [hxd.Res.text.intro.entry.getText(), hxd.Res.text.rooms.entry.getText(),];
|
||||||
hxd.Res.text.intro.entry.getText(),
|
var yarnFileNames = [hxd.Res.text.intro.entry.name, hxd.Res.text.rooms.entry.name,];
|
||||||
hxd.Res.text.rooms.entry.getText(),
|
|
||||||
];
|
|
||||||
var yarnFileNames = [
|
|
||||||
hxd.Res.text.intro.entry.name,
|
|
||||||
hxd.Res.text.rooms.entry.name,
|
|
||||||
];
|
|
||||||
dialogueManager.load(yarnText, yarnFileNames);
|
dialogueManager.load(yarnText, yarnFileNames);
|
||||||
|
|
||||||
globalEventBus.subscribe(LineShown, dialogue);
|
globalEventBus.subscribe(LineShown, dialogue);
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import h2d.col.Point;
|
import h2d.col.Point;
|
||||||
import h2d.Object;
|
import h2d.Object;
|
||||||
import h2d.SpriteBatch;
|
import h2d.SpriteBatch;
|
||||||
|
|
||||||
import tiled.types.TmxLayer;
|
import tiled.types.TmxLayer;
|
||||||
import tiled.types.TmxMap;
|
import tiled.types.TmxMap;
|
||||||
|
|
||||||
using tiled.TiledTools;
|
using tiled.TiledTools;
|
||||||
|
|
||||||
class TilemapLayer extends h2d.TileGroup {
|
class TilemapLayer extends h2d.TileGroup {
|
||||||
|
|
||||||
public var map:TmxMap;
|
public var map:TmxMap;
|
||||||
public var layer:TmxLayer;
|
public var layer:TmxLayer;
|
||||||
|
|
||||||
@ -41,12 +40,19 @@ class TilemapLayer extends h2d.TileGroup {
|
|||||||
var t = tsets.getImage(gid);
|
var t = tsets.getImage(gid);
|
||||||
var x = cx + ix * tw;
|
var x = cx + ix * tw;
|
||||||
var y = cy + iy * th + th - t.height;
|
var y = cy + iy * th + th - t.height;
|
||||||
if (gid.flippedHorizontally) addTransform(x + t.width, y, -1, 1, 0, t);
|
if (gid.flippedHorizontally)
|
||||||
else if (gid.flippedVertically) addTransform(x, y + t.height, 1, -1, 0, t);
|
addTransform(x + t.width, y, -1, 1, 0, t);
|
||||||
else if (gid.flippedDiagonally) addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
else if (gid.flippedVertically)
|
||||||
else add(x, y, t);
|
addTransform(x, y + t.height, 1, -1, 0, t);
|
||||||
|
else if (gid.flippedDiagonally)
|
||||||
|
addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
||||||
|
else
|
||||||
|
add(x, y, t);
|
||||||
|
}
|
||||||
|
if (++ix == chunk.width) {
|
||||||
|
iy++;
|
||||||
|
ix = 0;
|
||||||
}
|
}
|
||||||
if (++ix == chunk.width) { iy++; ix = 0; }
|
|
||||||
}
|
}
|
||||||
case Isometric:
|
case Isometric:
|
||||||
var isoW = tw >> 1;
|
var isoW = tw >> 1;
|
||||||
@ -60,15 +66,25 @@ class TilemapLayer extends h2d.TileGroup {
|
|||||||
var t = tsets.getImage(gid);
|
var t = tsets.getImage(gid);
|
||||||
var x = cx + (ix - iy) * isoW;
|
var x = cx + (ix - iy) * isoW;
|
||||||
var y = cy + (ix + iy) * isoH + th - t.height;
|
var y = cy + (ix + iy) * isoH + th - t.height;
|
||||||
if (gid.flippedHorizontally) addTransform(x + t.width, y, -1, 1, 0, t);
|
if (gid.flippedHorizontally)
|
||||||
else if (gid.flippedVertically) addTransform(x, y + t.height, 1, -1, 0, t);
|
addTransform(x + t.width, y, -1, 1, 0, t);
|
||||||
else if (gid.flippedDiagonally) addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
else if (gid.flippedVertically)
|
||||||
else add(x, y, t);
|
addTransform(x, y + t.height, 1, -1, 0, t);
|
||||||
|
else if (gid.flippedDiagonally)
|
||||||
|
addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
||||||
|
else
|
||||||
|
add(x, y, t);
|
||||||
|
}
|
||||||
|
if (++ix == chunk.width) {
|
||||||
|
iy++;
|
||||||
|
ix = 0;
|
||||||
}
|
}
|
||||||
if (++ix == chunk.width) { iy++; ix = 0; }
|
|
||||||
}
|
}
|
||||||
case Staggered(staggerYAxis, staggerIndexOdd):
|
case Staggered(staggerYAxis, staggerIndexOdd):
|
||||||
var staggerX = 0, staggerY = 0, stepX = tw >> 1, stepY = th >> 1;
|
var staggerX = 0,
|
||||||
|
staggerY = 0,
|
||||||
|
stepX = tw >> 1,
|
||||||
|
stepY = th >> 1;
|
||||||
var cx = chunk.x * stepX + layer.offsetX;
|
var cx = chunk.x * stepX + layer.offsetX;
|
||||||
var cy = chunk.y * stepY + layer.offsetY;
|
var cy = chunk.y * stepY + layer.offsetY;
|
||||||
if (staggerYAxis) {
|
if (staggerYAxis) {
|
||||||
@ -94,12 +110,19 @@ class TilemapLayer extends h2d.TileGroup {
|
|||||||
var t = tsets.getImage(gid);
|
var t = tsets.getImage(gid);
|
||||||
var x = cx + ix * stepX + staggerX * (ix % 1);
|
var x = cx + ix * stepX + staggerX * (ix % 1);
|
||||||
var y = cy + iy * stepY + th - t.height;
|
var y = cy + iy * stepY + th - t.height;
|
||||||
if (gid.flippedHorizontally) addTransform(x + t.width, y, -1, 1, 0, t);
|
if (gid.flippedHorizontally)
|
||||||
else if (gid.flippedVertically) addTransform(x, y + t.height, 1, -1, 0, t);
|
addTransform(x + t.width, y, -1, 1, 0, t);
|
||||||
else if (gid.flippedDiagonally) addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
else if (gid.flippedVertically)
|
||||||
else add(x, y, t);
|
addTransform(x, y + t.height, 1, -1, 0, t);
|
||||||
|
else if (gid.flippedDiagonally)
|
||||||
|
addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
||||||
|
else
|
||||||
|
add(x, y, t);
|
||||||
|
}
|
||||||
|
if (++ix == chunk.width) {
|
||||||
|
iy++;
|
||||||
|
ix = 0;
|
||||||
}
|
}
|
||||||
if (++ix == chunk.width) { iy++; ix = 0; }
|
|
||||||
}
|
}
|
||||||
case Hexagonal(sideLength, staggerYAxis, staggerIndexOdd):
|
case Hexagonal(sideLength, staggerYAxis, staggerIndexOdd):
|
||||||
// TODO: Fix
|
// TODO: Fix
|
||||||
@ -134,19 +157,26 @@ class TilemapLayer extends h2d.TileGroup {
|
|||||||
var t = tsets.getImage(gid);
|
var t = tsets.getImage(gid);
|
||||||
var x = cx + ix * stepX;
|
var x = cx + ix * stepX;
|
||||||
var y = cy + iy * stepY + th - t.height;
|
var y = cy + iy * stepY + th - t.height;
|
||||||
if (gid.flippedHorizontally) addTransform(x + t.width, y, -1, 1, 0, t);
|
if (gid.flippedHorizontally)
|
||||||
else if (gid.flippedVertically) addTransform(x, y + t.height, 1, -1, 0, t);
|
addTransform(x + t.width, y, -1, 1, 0, t);
|
||||||
else if (gid.flippedDiagonally) addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
else if (gid.flippedVertically)
|
||||||
else add(x, y, t);
|
addTransform(x, y + t.height, 1, -1, 0, t);
|
||||||
|
else if (gid.flippedDiagonally)
|
||||||
|
addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
||||||
|
else
|
||||||
|
add(x, y, t);
|
||||||
|
}
|
||||||
|
if (++ix == chunk.width) {
|
||||||
|
iy++;
|
||||||
|
ix = 0;
|
||||||
}
|
}
|
||||||
if (++ix == chunk.width) { iy++; ix = 0; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addTile(tx:Int, ty:Int, ox:Float, oy:Float, gid:TmxTileIndex) {
|
public function addTile(tx:Int, ty:Int, ox:Float, oy:Float, gid:TmxTileIndex) {
|
||||||
if (gid == 0) return;
|
if (gid == 0)
|
||||||
|
return;
|
||||||
var t = map.tilesets.getImage(gid);
|
var t = map.tilesets.getImage(gid);
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
var x, y;
|
var x, y;
|
||||||
@ -186,12 +216,14 @@ class TilemapLayer extends h2d.TileGroup {
|
|||||||
y = ty * map.tileHeight + ((tx + 1) % 2) * (map.tileHeight >> 1);
|
y = ty * map.tileHeight + ((tx + 1) % 2) * (map.tileHeight >> 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gid.flippedHorizontally) addTransform(x + t.width, y, -1, 1, 0, t);
|
if (gid.flippedHorizontally)
|
||||||
else if (gid.flippedVertically) addTransform(x, y + t.height, 1, -1, 0, t);
|
addTransform(x + t.width, y, -1, 1, 0, t);
|
||||||
else if (gid.flippedDiagonally) addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
else if (gid.flippedVertically)
|
||||||
else add(x, y, t);
|
addTransform(x, y + t.height, 1, -1, 0, t);
|
||||||
|
else if (gid.flippedDiagonally)
|
||||||
|
addTransform(x + t.width, y + t.height, -1, -1, 0, t);
|
||||||
|
else
|
||||||
|
add(x, y, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import hxyarn.dialogue.OptionSet;
|
|||||||
import hxyarn.dialogue.markup.MarkupParseResult;
|
import hxyarn.dialogue.markup.MarkupParseResult;
|
||||||
import hxyarn.compiler.Compiler;
|
import hxyarn.compiler.Compiler;
|
||||||
import hxyarn.compiler.CompilationJob;
|
import hxyarn.compiler.CompilationJob;
|
||||||
|
|
||||||
import event.EventBus;
|
import event.EventBus;
|
||||||
import dialogue.command.ICommandHandler;
|
import dialogue.command.ICommandHandler;
|
||||||
import dialogue.event.LineShown;
|
import dialogue.event.LineShown;
|
||||||
@ -72,11 +71,9 @@ class DialogueManager {
|
|||||||
dialogue.resume();
|
dialogue.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logDebugMessage(message:String):Void {
|
public function logDebugMessage(message:String):Void {}
|
||||||
}
|
|
||||||
|
|
||||||
public function logErrorMessage(message:String):Void {
|
public function logErrorMessage(message:String):Void {}
|
||||||
}
|
|
||||||
|
|
||||||
public function nextLine(event:NextLine) {
|
public function nextLine(event:NextLine) {
|
||||||
if ((dialogue.isActive()) && (!waitingForOption))
|
if ((dialogue.isActive()) && (!waitingForOption))
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package scene;
|
package scene;
|
||||||
|
|
||||||
import scene.WorldMapScene;
|
import scene.WorldMapScene;
|
||||||
|
|
||||||
import event.ChangeSceneEvent;
|
import event.ChangeSceneEvent;
|
||||||
|
|
||||||
import components.MenubuttonComponent;
|
import components.MenubuttonComponent;
|
||||||
|
|
||||||
@:uiComp("heading")
|
@:uiComp("heading")
|
||||||
@ -46,7 +44,6 @@ class TitleScene extends h2d.Flow implements GameScene implements h2d.domkit.Obj
|
|||||||
#else
|
#else
|
||||||
btnQuit.remove();
|
btnQuit.remove();
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getH2dObject() {
|
public function getH2dObject() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user