Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package example.portal
- {
- import nape.geom.Vec2;
- import nape.phys.Body;
- import nape.shape.Shape;
- /**
- * ...
- * @author liu wong
- *
- */
- public class Portal
- {
- public var target:Portal; // where entering this portal takes you
- public var collide:Array/*Shape*/; // shapes to always collide with belonging to portal when passing through
- public var ignore:Array/*Shape*/; // shapes to never collide with belonging to portal whe passing through
- public var body:Body;
- public var sensor:Shape;
- public var position:Vec2; // position of portal centre (local to body)
- public var direction:Vec2; // direction of portal (local to body)
- public var width:Number; // width of portal
- public function Portal(trgt:Portal, cld:Array, ignr:Array, bdy:Body, snsr:Shape, pos:Vec2, dir:Vec2, wdth:Number):void
- {
- target = trgt;
- collide = cld;
- ignore = ignr;
- body = bdy;
- sensor = snsr;
- position = pos;
- direction = dir;
- width = wdth;
- }
- }
- }
- package example.portal
- {
- import nape.phys.Body;
- /**
- * ...
- * @author liu wong
- *
- */
- public class PortalPair
- {
- public var portalA:Portal;
- public var portalB:Portal;
- public var bodyA:Body;
- public var bodyB:Body;
- public function PortalPair(pA:Portal, pB:Portal, bA:Body, bB:Body):void
- {
- portalA = pA;
- portalB = pB;
- bodyA = bA;
- bodyB = bB;
- }
- }
- }
- package example.portal
- {
- import example.portal.Portal;
- /**
- * ...
- * @author liu wong
- *
- */
- public class PortalShapeData
- {
- public var portal:Portal;
- public var portal_target:Boolean;
- public function PortalShapeData(p:Portal, ptarget:Boolean):void
- {
- portal = p;
- portal_target = ptarget;
- }
- }
- }
- package example.portal
- {
- /**
- * ...
- * @author liu wong
- *
- */
- public class PortableShapeData
- {
- public var portal_id:int;
- public var portals:Array/*PortalShapeData*/;
- public var portal_active:int;
- }
- }
- package example.portal
- {
- import example.portal.PortalPair;
- /**
- * ...
- * @author liu wong
- *
- */
- public class PortableBodyData
- {
- public var portal_pairs:Array/*PortalPair*/;
- }
- }
- package example.portal
- {
- /**
- * ...
- * @author liu wong
- *
- */
- public class PortalSensorData
- {
- public var portal:Portal;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement