private void createScreenBorders(MTComponent parent) { // Left border float borderWidth = 50f; float borderHeight = app.height; Vector3D pos = new Vector3D(-(borderWidth / 2f), app.height / 2f); PhysicsRectangle borderLeft = new PhysicsRectangle(pos, borderWidth, borderHeight, app, world, 0, 0, 0, scale); borderLeft.setName("borderLeft"); parent.addChild(borderLeft); // Right border pos = new Vector3D(app.width + (borderWidth / 2), app.height / 2); PhysicsRectangle borderRight = new PhysicsRectangle(pos, borderWidth, borderHeight, app, world, 0, 0, 0, scale); borderRight.setName("borderRight"); parent.addChild(borderRight); // Top border borderWidth = app.width; borderHeight = 50f; pos = new Vector3D(app.width / 2, -(borderHeight / 2)); PhysicsRectangle borderTop = new PhysicsRectangle(pos, borderWidth, borderHeight, app, world, 0, 0, 0, scale); borderTop.setName("borderTop"); parent.addChild(borderTop); // Bottom border pos = new Vector3D(app.width / 2, app.height + (borderHeight / 2)); PhysicsRectangle borderBottom = new PhysicsRectangle(pos, borderWidth, borderHeight, app, world, 0, 0, 0, scale); borderBottom.setName("borderBottom"); parent.addChild(borderBottom); }
@Override protected void polyDefB4CreationCallback(PolygonDef def) { super.polyDefB4CreationCallback(def); def.isSensor = true; // THIS AS SENSOR! }
@Override protected void bodyDefB4CreationCallback(BodyDef def) { def.isBullet = true; super.bodyDefB4CreationCallback(def); }