mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Gisela and target point added.
This commit is contained in:
@@ -17,6 +17,8 @@ export default class RetroArchitecture
|
||||
this.tileHeight = this.tileset.getHeight();
|
||||
this.startX = 0;
|
||||
this.startY = 0;
|
||||
this.targetX = 0;
|
||||
this.targetY = 0;
|
||||
|
||||
this.init();
|
||||
}
|
||||
@@ -158,12 +160,33 @@ export default class RetroArchitecture
|
||||
return architectureRect.isContainingPoint(geometryPoint);
|
||||
}
|
||||
|
||||
resetMovableToStartPosition(movable)
|
||||
setMovableToStartPosition(movable)
|
||||
{
|
||||
movable.position.x = this.tileWidth * this.startX + this.tileWidth * 0.5;
|
||||
movable.position.y = this.tileHeight * this.startY + this.tileHeight * 0.5;
|
||||
}
|
||||
|
||||
setMovableToTargetPosition(movable)
|
||||
{
|
||||
movable.position.x = this.tileWidth * this.targetX + this.tileWidth * 0.5;
|
||||
movable.position.y = this.tileHeight * this.targetY + this.tileHeight;
|
||||
}
|
||||
|
||||
isMovableInsideTargetPosition(movable)
|
||||
{
|
||||
let tileRect = new GeometryRect(
|
||||
this.targetX * this.tileWidth,
|
||||
this.targetY * this.tileHeight,
|
||||
this.tileWidth,
|
||||
this.tileHeight
|
||||
);
|
||||
|
||||
return tileRect.isContainingPoint(movable.getPositionHeadLeft()) ||
|
||||
tileRect.isContainingPoint(movable.getPositionHeadRight()) ||
|
||||
tileRect.isContainingPoint(movable.getPositionFootLeft()) ||
|
||||
tileRect.isContainingPoint(movable.getPositionFootRight());
|
||||
}
|
||||
|
||||
draw(context, camera = null)
|
||||
{
|
||||
let viewX = parseInt(Math.floor(Math.max(0, camera.position.x) / this.tileWidth));
|
||||
@@ -205,6 +228,8 @@ export default class RetroArchitecture
|
||||
|
||||
architecture.startX = data.startX;
|
||||
architecture.startY = data.startY;
|
||||
architecture.targetX = data.targetX;
|
||||
architecture.targetY = data.targetY;
|
||||
|
||||
for (let y = 0; y < data.rows; y++) {
|
||||
for (let x = 0; x < data.columns; x++) {
|
||||
|
||||
Reference in New Issue
Block a user