iso-engine blades sample terrains
This commit is contained in:
@@ -45,20 +45,31 @@ class ScenData {
|
||||
}
|
||||
|
||||
var path = '$data/Terrain Graphics/G$num.bmp';
|
||||
if (!FileSystem.exists(path)) return null;
|
||||
spriteSheets[num] = SpriteSheet.fromSimpleBmp(path, 46, 55);
|
||||
return spriteSheets[num];
|
||||
}
|
||||
|
||||
function emptySprite() {
|
||||
var s = new FlxSprite(0, 0);
|
||||
s.makeGraphic(46, 55, FlxColor.TRANSPARENT);
|
||||
s.alpha = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
public function floorSprite(floorId:Int) {
|
||||
if (!floorData.exists(floorId)) {
|
||||
var s = new FlxSprite(0, 0);
|
||||
s.makeGraphic(46, 55, FlxColor.TRANSPARENT);
|
||||
return s;
|
||||
return emptySprite();
|
||||
}
|
||||
|
||||
var fd = floorData[floorId];
|
||||
|
||||
var sprite = floorOrTerrainSpriteSheet(fd.which_sheet).clone();
|
||||
var sheet = floorOrTerrainSpriteSheet(fd.which_sheet);
|
||||
if (sheet == null) {
|
||||
return emptySprite();
|
||||
}
|
||||
var sprite = sheet.clone();
|
||||
|
||||
sprite.animation.frameIndex = fd.which_icon;
|
||||
|
||||
// TODO if it's animated add the animations
|
||||
@@ -67,9 +78,18 @@ class ScenData {
|
||||
}
|
||||
|
||||
public function terrainSprite(terrainId:Int) {
|
||||
if (!terrainData.exists(terrainId)) {
|
||||
var s = new FlxSprite(0, 0);
|
||||
s.makeGraphic(46, 55, FlxColor.TRANSPARENT);
|
||||
return s;
|
||||
}
|
||||
var td = terrainData[terrainId];
|
||||
|
||||
var sprite = floorOrTerrainSpriteSheet(td.which_sheet).clone();
|
||||
var sheet = floorOrTerrainSpriteSheet(td.which_sheet);
|
||||
if (sheet == null) {
|
||||
return emptySprite();
|
||||
}
|
||||
var sprite = sheet.clone();
|
||||
sprite.animation.frameIndex = td.which_icon;
|
||||
|
||||
// TODO if it's a tall terrain combine it with the upper sprite and set its origin to offset y
|
||||
|
||||
Reference in New Issue
Block a user