pixel changes

This commit is contained in:
Svipal 2020-01-26 22:51:01 +01:00
parent e4857ce48a
commit 946857f756
16 changed files with 13712 additions and 232393 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

24158
dist/phaser.js vendored

File diff suppressed because it is too large Load diff

6
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

1
game

@ -1 +0,0 @@
Subproject commit fdceebfbc0bd64ff9aef718bb3106ef4c4cd99da

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "phaser",
"version": "3.22.0",
"version": "3.23.0-beta1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,39 +0,0 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var MyScene = /** @class */ (function (_super) {
__extends(MyScene, _super);
function MyScene() {
return _super !== null && _super.apply(this, arguments) || this;
}
MyScene.prototype.preload = function () {
this.load.atlas('cards', 'assets/atlas/cards.png', 'assets/atlas/cards.json');
};
MyScene.prototype.create = function () {
var sprite = this.add.sprite(400, 300, 'cards', 'clubs3');
sprite.setInteractive();
this.input.on('pointerdown', function () {
sprite.setFrame('hearts4');
});
};
return MyScene;
}(Phaser.Scene));
var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: MyScene
};
var game = new Phaser.Game(config);
//# sourceMappingURL=game.js.map

View file

@ -1 +0,0 @@
{"version":3,"file":"game.js","sourceRoot":"","sources":["../src/game.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;IAAsB,2BAAY;IAAlC;;IAoBA,CAAC;IAlBU,yBAAO,GAAd;QAEI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;IAClF,CAAC;IAEM,wBAAM,GAAb;QAEI,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE1D,MAAM,CAAC,cAAc,EAAE,CAAC;QAExB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE;YAEzB,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAE/B,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,cAAC;AAAD,CAAC,AApBD,CAAsB,MAAM,CAAC,KAAK,GAoBjC;AAED,IAAI,MAAM,GAAG;IACT,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,OAAO;CACjB,CAAC;AAEF,IAAI,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC"}

View file

@ -66,12 +66,15 @@ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height,
if (mapData === null)
{
console.log("null mapdata")
mapData = new MapData({
tileWidth: tileWidth,
tileHeight: tileHeight,
width: width,
height: height
});
} else {
console.log(mapData.orientation)
}
return new Tilemap(scene, mapData);

View file

@ -35,7 +35,9 @@ var Rectangle = require('../geom/rectangle');
* @param {integer} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps
* support multiple tileset sizes within one map, but they are still placed at intervals of the
* base tile height.
* @param {string} orientation - The Tilemap's orientation
*/
var Tile = new Class({
Mixins: [
@ -46,7 +48,7 @@ var Tile = new Class({
initialize:
function Tile (layer, index, x, y, width, height, baseWidth, baseHeight)
function Tile (layer, index, x, y, width, height, baseWidth, baseHeight, orientation)
{
/**
* The LayerData in the Tilemap data that this tile belongs to.
@ -274,6 +276,14 @@ var Tile = new Class({
* @since 3.0.0
*/
this.physics = {};
/**
* An empty object where physics-engine specific information (e.g. bodies) may be stored.
*
* @name Phaser.Tilemaps.Tile#orientation
* @type {string}
* @since 3.2.PR_svipal
*/
this.orientation = orientation
},
/**
@ -709,9 +719,16 @@ var Tile = new Class({
// Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
// coordinate needs to be adjusted by the difference.
this.pixelX = this.x * this.baseWidth;
this.pixelY = this.y * this.baseHeight;
if (this.orientation = "orthogonal") {
this.pixelX = this.x * this.baseWidth;
this.pixelY = this.y * this.baseHeight;
} else if (this.orientation = "isometric") {
console.log("isopix")
// once we get the 'top' of the losange we need to remove half of the tile width.
this.pixelX = (this.x - this.y) * this.baseWidth / 2;
this.pixelY = (this.x + this.y) * this.baseHeight / 2;
}
// this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
return this;

View file

@ -512,7 +512,7 @@ var Tilemap = new Class({
for (var tileX = 0; tileX < width; tileX++)
{
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight));
row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight, this.orientation));
}
layerData.data.push(row);

View file

@ -24,7 +24,7 @@ GameObjectCreator.register('tilemap', function (config)
{
// Defaults are applied in ParseToTilemap
var c = (config !== undefined) ? config : {};
console.log("TC tilemap")
return ParseToTilemap(
this.scene,
c.key,