Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
portal tweaks - scale not working properly for the polygons...
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedotalmond committed Mar 8, 2012
1 parent 135f44b commit 9924538
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/mikedotalmond/napoleon/constraints/portal/PortalManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ package mikedotalmond.napoleon.constraints.portal {
object = null;
} else {
if (object == limbo.mBody) {
//node = limbo.sBody.userData as INapeNode;
limbo.sBody = null;
} else {
//node = limbo.mBody.userData as INapeNode;
limbo.mBody = null;
}
//node.setBodyNull();
//scene.removeChild(node as Node2D);
}

delfromLimbo(info.limbos, limbo);
Expand All @@ -136,13 +140,12 @@ package mikedotalmond.napoleon.constraints.portal {
if (info.master.shapes.length == 0) {
info.master.space = null;
node = info.master.userData as INapeNode;
scene.removeChild(node as Node2D);
node = null;
} else {
info.slave.space = null;
node = info.slave.userData as INapeNode;
scene.removeChild(node as Node2D);
}
scene.removeChild(node as Node2D);
node = null;
delfrom(infos, info);
}
}
Expand All @@ -162,7 +165,7 @@ package mikedotalmond.napoleon.constraints.portal {
}

var nortal :Portal = portal.target;
var scale :Number = nortal.width / portal.width;
var scale :Number = 1;// nortal.width / portal.width;
var node :INapeNode;
var clone :INapeNode;
var cloneBody :Body;
Expand All @@ -171,7 +174,7 @@ package mikedotalmond.napoleon.constraints.portal {
//node = object.userData is INapeNode ? (object.userData as INapeNode) : (object.userData as Portal).node;
node = object.userData as INapeNode;
clone = node.copyAsINapeNode();
clone.scale(scale, scale);
//clone.scale(scale, scale); // not quite working properly...
cloneBody = clone.body;
scene.addChild(clone as Node2D);

Expand Down
2 changes: 1 addition & 1 deletion src/mikedotalmond/napoleon/examples/Portals.as
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ package mikedotalmond.napoleon.examples {
p2.node.body.type = BodyType.KINEMATIC;
p2.node.body.angularVel = 1;
/*
//funky portal body now :)
//funky portal body now :) ... many things wrong with this part of the port - and it breaks pretty easily
node = new NapeQuad2D(84, 100);
(node as NapeQuad2D).init(new Vec2(300, 225), null, BodyType.DYNAMIC);
(node as NapeQuad2D).body.cbType = PortalManager.OBJECT;
Expand Down

0 comments on commit 9924538

Please sign in to comment.