Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ****************************************************************
- // This is a simple HaxBall stadium meant to be used as an example.
- // ****************************************************************
- // HaxBall stadiums are a JSON object composed of lists of vertexes, segments, planes, discs, goals and traits.
- // A Vertex is an invisible solid 2d point which discs can't go through.
- // A Segment connects two vertexes with a wall. They can be visible or invisible, curved or straight. (It is recommended that the vertexes connected by a segment have the same physical properties as it, otherwise the corners of the segment will behave different than the sides.)
- // A Plane defines a one sided boundary, objects can only be on one side of a plane.
- // A Disc defines a physical disc (Same as the goal posts, the player discs or the ball).
- // A Goal is a segment defined by two points, when the ball passes through this line a goal will be scored.
- // A trait is an optional feature which lets you avoid repetition by defining properties which are common to many objects.
- // Vertexes, Segments, Planes and Discs all share the following properties:
- // "bCoef" : <Number from 0.0 to 1.0> - Defines the bouncing coefficient.
- // "cMask" : <Array of collision layers, eg: ["ball", "red", "blue"]> - Stands for collision mask, it defines which layers this object can collide with.
- // "cGroup" : <Array of collision layers, eg: ["ball", "red", "blue"]> - Stands for collision group, it defines in which collision layers this object lives.
- // "trait" : <Name of a trait to inherit from> - When this property is specified the object will inherit the properties defined on the trait.
- // In addition there are properties specific to each one:
- // Vertexes:
- // "x" : <Number> - The X coordinate of the vertex.
- // "y" : <Number> - The Y coordinate of the vertex.
- // Segments:
- // "v0" : <Integer number> - The index of a vertex to connect with this segment.
- // "v1" : <Integer number> - The index of the other vertex to connect with this segment.
- // "curve" : <Angle in degrees from -350.0 to 350.0> - How much this segment curves.
- // "vis" : <true or false> - Wether this segment is visible or not.
- // "color" : <Color> - Defines the color of the segment.
- // Plane:
- // "normal" : <[Number, Number]> - The normal(direction vector) of the plane.
- // "dist" : <Number> - The distance to <0,0>.
- // Disc:
- // "radius" : <Number> - The radius of the disc.
- // "invMass" : <Number >= 0 > - The inverse of the mass, the closer to 0 the heavier this object is. (Discs with 0 invMass can't move and act as static objects)
- // "color" : <Color> - The fill color of the disc.
- // Goal:
- // "p0" : <[Number, Number]> - First point of the goal.
- // "p1" : <[Number, Number]> - Second point of the goal.
- // "team" : <Either "red" or "blue"> - The team whose this goal belongs to.
- // ***********************
- // Some other useful info:
- // ***********************
- // Collision layers are defined as arrays of the following strings:
- // "ball" - The collision group of the ball.
- // "red" - The collision group for red players.
- // "blue" - The collision group for blue players.
- // "wall" - The default collision group for all stadium objects.
- // "redKO" - A collision group players will only collide with during the red kickoff. (Useful for kickoff barriers)
- // "blueKO" - A collision group players will only collide with during the blue kickoff. (Useful for kickoff barriers)
- // Colors can be defined in two ways (always RGB):
- // * As a hexa string, eg "F7A2DD"
- // * As an array of numbers from 0 to 255, eg: [255, 128, 0].
- // ****************************************
- // Here's the annotated stadium definition:
- // ****************************************
- {
- "name" : "600Arena", // Set the name of the stadium
- "width" : 670, // width and height only constrain the camera scrolling.
- "height" : 370,
- "spawnDistance" : 420, // Set how far from the ball the teams will spawn
- "bg" : { "type" : "grass", "width" : 600, "height" : 300, "kickOffRadius" : 60, "cornerRadius" : 0}, // Set the background. This is only visual, it doesnt' affect the physics at all.
- // The list of vertexes:
- "vertexes" : [
- // Left side of the ball area:
- { "x" : -600, "y" : 300, "trait" : "ballArea" }, // Index 0 - Bottom corner.
- { "x" : -600, "y" : 75, "trait" : "ballArea" }, // Index 1 - Bottom goal post.
- { "x" : -600, "y" : -75, "trait" : "ballArea" }, // Index 2 - Top goal post.
- { "x" : -600, "y" : -300, "trait" : "ballArea" }, // Index 3 - Top corner.
- // Right side of the ball area:
- { "x" : 600, "y" : 300, "trait" : "ballArea" }, // Index 4 - Bottom corner.
- { "x" : 600, "y" : 75, "trait" : "ballArea" }, // Index 5 - Bottom goal post.
- { "x" : 600, "y" : -75, "trait" : "ballArea" }, // Index 6 - Top goal post.
- { "x" : 600, "y" : -300, "trait" : "ballArea" }, // Index 7 - Top corner.
- // Vertexes involved on the kickoff barrier:
- { "x" : 0, "y" : 370, "trait" : "kickOffBarrier" }, // Index 8 - Bottom center.
- { "x" : 0, "y" : 60, "trait" : "kickOffBarrier" }, // Index 9 - Bottom of the kickoff circle.
- { "x" : 0, "y" : -60, "trait" : "kickOffBarrier" }, // Index 10 - Top of the kickoff circle.
- { "x" : 0, "y" : -370, "trait" : "kickOffBarrier" }, // Index 11 - Top center.
- { "x" : -640, "y" : 75, "trait" : "ballArea" }, // 12
- { "x" : -640, "y" : -75, "trait" : "ballArea" }, // 13
- { "x" : 640, "y" : 75, "trait" : "ballArea" }, // 14
- { "x" : 640, "y" : -75, "trait" : "ballArea" }, // 15
- { "x" : -600, "y" : 265, "trait" : "rogBlue" }, //16
- { "x" : -565, "y" : 300, "trait" : "rogBlue" }, //17
- { "x" : -600, "y" : -265, "trait" : "rogBlue" }, //18
- { "x" : -565, "y" : -300, "trait" : "rogBlue" }, //19
- { "x" : 600, "y" : 265, "trait" : "rogRed" }, //20
- { "x" : 565, "y" : 300, "trait" : "rogRed" }, //21
- { "x" : 600, "y" : -265, "trait" : "rogRed" }, //22
- { "x" : 565, "y" : -300, "trait" : "rogRed" }, //23
- // LINIE BOCZNE I SRODKOWE (POGRUBIENIE):
- { "x" : -600, "y" : -300, "trait" : "linia" }, //24
- { "x" : 600, "y" : -300, "trait" : "linia" }, //25
- { "x" : -600, "y" : 300, "trait" : "linia" }, //26
- { "x" : 600, "y" : 300, "trait" : "linia" }, //27
- { "x" : 0, "y" : 300, "trait" : "linia" }, //28
- { "x" : 0, "y" : -300, "trait" : "linia" }, //29
- // POLE PODBRAMKOWE - CZERWONE:
- { "x" : -600, "y" : 80, "trait" : "linia" }, //30
- { "x" : -600, "y" : -80, "trait" : "linia" }, //31
- { "x" : -545, "y" : 80, "trait" : "linia" }, //32
- { "x" : -545, "y" : -80, "trait" : "linia" }, //33
- //POLE KARNE - CZERWONE:
- { "x" : -600, "y" : 138, "trait" : "karne_red" }, //34
- { "x" : -600, "y" : -138, "trait" : "karne_red" }, //35
- { "x" : -480, "y" : 138, "trait" : "karne_red" }, //36
- { "x" : -480, "y" : -138, "trait" : "karne_red" }, //37
- // POLE PODBRAMKOWE - NIEBIESKIE:
- { "x" : 600, "y" : 80, "trait" : "linia" }, //38
- { "x" : 600, "y" : -80, "trait" : "linia" }, //39
- { "x" : 545, "y" : 80, "trait" : "linia" }, //40
- { "x" : 545, "y" : -80, "trait" : "linia" }, //41
- //POLE KARNE - NIEBIESKIE:
- { "x" : 600, "y" : 138, "trait" : "karne_blue" }, //42
- { "x" : 600, "y" : -138, "trait" : "karne_blue" }, //43
- { "x" : 480, "y" : 138, "trait" : "karne_blue" }, //44
- { "x" : 480, "y" : -138, "trait" : "karne_blue" }, //45
- //SRODEK PUNKT:
- { "x" : -3, "y" : 0, "trait" : "linia" }, //46
- { "x" : 3, "y" : 0, "trait" : "linia" }, //47
- //LEWY GORNY ROG - STREFA:
- { "x" : -670, "y" : -265, "trait" : "roglineBlue" }, //48
- { "x" : -565, "y" : -340, "trait" : "roglineBlue" }, //49
- //LEWY DOLNY ROG - STREFA:
- { "x" : -670, "y" : 265, "trait" : "roglineBlue" }, //50
- { "x" : -565, "y" : 340, "trait" : "roglineBlue" }, //51
- //LEWY GORNY ROG - STREFA:
- { "x" : 670, "y" : -265, "trait" : "roglineRed" }, //52
- { "x" : 565, "y" : -340, "trait" : "roglineRed" }, //53
- //LEWY DOLNY ROG - STREFA:
- { "x" : 670, "y" : 265, "trait" : "roglineRed" }, //54
- { "x" : 565, "y" : 340, "trait" : "roglineRed" }, //55
- //DOLNY - SRODEK - LEWA:
- { "x" : -240, "y" : 340, "trait" : "roglineRed" }, //56
- //DOLNY - SRODEK - PRAWA:
- { "x" : 240, "y" : 340, "trait" : "roglineRed" }, //57
- //GORNY - SRODEK - LEWA:
- { "x" : -240, "y" : -340, "trait" : "roglineRed" }, //58
- //GORNY - SRODEK - PRAWA:
- { "x" : 240, "y" : -340, "trait" : "roglineRed" } //59
- ],
- // The list of segments:
- "segments" : [
- // Left side ball area walls:
- { "v0" : 0, "v1" : 1, "trait" : "ballArea" }, // Connects bottom corner to bottom goal post.
- { "v0" : 2, "v1" : 3, "trait" : "ballArea" }, // Connects top corner to top goal post.
- // Right side ball area walls:
- { "v0" : 4, "v1" : 5, "trait" : "ballArea" }, // Connects bottom corner to bottom goal post.
- { "v0" : 6, "v1" : 7, "trait" : "ballArea" }, // Connects top corner to top goal post.
- // Goal nets:
- { "v0" : 1, "v1" : 12, "trait" : "goalNetRed" },
- { "v0" : 12, "v1" : 13, "trait" : "goalNetRed" },
- { "v0" : 13, "v1" : 2, "trait" : "goalNetRed" },
- { "v0" : 6, "v1" : 15, "trait" : "goalNetBlue" },
- { "v0" : 15, "v1" : 14, "trait" : "goalNetBlue" },
- { "v0" : 14, "v1" : 5, "trait" : "goalNetBlue" },
- // Kickoff barriers:
- { "v0" : 8, "v1" : 9, "trait" : "kickOffBarrier" }, // Connects bottom center to kickoff circle bottom.
- { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : 180, "cGroup" : ["blueKO"] }, // Connects Kickoff circle top and bottom, curve = 180 makes half a circle.
- { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : -180, "cGroup" : ["redKO"] }, // Connects Kickoff circle top and bottom again, curve = -180 makes the other half.
- { "v0" : 10, "v1" : 11, "trait" : "kickOffBarrier" }, // Connects kickoff circle top to top center.
- { "v0" : 16, "v1" : 17, "trait" : "rogBlue" },
- { "v0" : 19, "v1" : 18, "trait" : "rogBlue" },
- { "v0" : 21, "v1" : 20, "trait" : "rogRed" },
- { "v0" : 22, "v1" : 23, "trait" : "rogRed" },
- { "v0" : 24, "v1" : 25, "trait" : "linia" },
- { "v0" : 25, "v1" : 27, "trait" : "linia" },
- { "v0" : 26, "v1" : 27, "trait" : "linia" },
- { "v0" : 24, "v1" : 26, "trait" : "linia" },
- { "v0" : 28, "v1" : 29, "trait" : "linia" },
- { "v0" : 9, "v1" : 10, "trait" : "linia", "curve" : 180},
- { "v0" : 9, "v1" : 10, "trait" : "linia", "curve" : -180},
- //PODBRAMKOWE - CZERWONE:
- { "v0" : 30, "v1" : 32, "trait" : "linia" },
- { "v0" : 32, "v1" : 33, "trait" : "linia" },
- { "v0" : 31, "v1" : 33, "trait" : "linia" },
- //KARNE - CZERWONE:
- { "v0" : 35, "v1" : 37, "trait" : "karne_red" },
- { "v0" : 34, "v1" : 36, "trait" : "karne_red" },
- { "v0" : 36, "v1" : 37, "trait" : "karne_red" },
- { "v0" : 34, "v1" : 35, "trait" : "karne_red" },
- //PODBRAMKOWE - NIEBIESKIE:
- { "v0" : 38, "v1" : 40, "trait" : "linia" },
- { "v0" : 40, "v1" : 41, "trait" : "linia" },
- { "v0" : 39, "v1" : 41, "trait" : "linia" },
- //KARNE - NIEBIESKIE:
- { "v0" : 43, "v1" : 45, "trait" : "karne_blue" },
- { "v0" : 42, "v1" : 44, "trait" : "karne_blue" },
- { "v0" : 44, "v1" : 45, "trait" : "karne_blue" },
- { "v0" : 42, "v1" : 43, "trait" : "karne_blue" },
- //SRODEK - PUNKT:
- { "v0" : 46, "v1" : 47, "trait" : "linia" },
- //LEWY GORNY ROG - STREFA:
- { "v0" : 18, "v1" : 48, "trait" : "roglineBlue" },
- { "v0" : 19, "v1" : 49, "trait" : "roglineBlue" },
- //LEWY DOLNY ROG - STREFA:
- { "v0" : 16, "v1" : 50, "trait" : "roglineBlue" },
- { "v0" : 17, "v1" : 51, "trait" : "roglineBlue" },
- //PRAWY GORNY ROG - STREFA:
- { "v0" : 22, "v1" : 52, "trait" : "roglineRed" },
- { "v0" : 23, "v1" : 53, "trait" : "roglineRed" },
- //PRAWY DOLNY ROG - STREFA:
- { "v0" : 20, "v1" : 54, "trait" : "roglineRed" },
- { "v0" : 21, "v1" : 55, "trait" : "roglineRed" },
- //LEWY DOLNY - SRODEK:
- { "v0" : 51, "v1" : 56, "trait" : "roglineBlue" },
- //PRAWY DOLNY - SRODEK:
- { "v0" : 55, "v1" : 57, "trait" : "roglineRed" },
- //LEWY GORNY - SRODEK:
- { "v0" : 49, "v1" : 58, "trait" : "roglineBlue" },
- //PRAWY GORNY - SRODEK:
- { "v0" : 53, "v1" : 59, "trait" : "roglineRed" }
- ],
- // List of goals:
- "goals" : [
- { "p0" : [-600, 75], "p1" : [-600,-75], "team" : "red" },
- { "p0" : [600, 75], "p1" : [600,-75], "team" : "blue" }
- ],
- // List of discs:
- "discs" : [
- // Left posts:
- { "pos" : [-600, 75], "trait" : "goalPostRed" },
- { "pos" : [-600, -75], "trait" : "goalPostRed" },
- // Right posts:
- { "pos" : [ 600, 75], "trait" : "goalPostBlue" },
- { "pos" : [ 600, -75], "trait" : "goalPostBlue" },
- // PACHOLKI DO STREF - LEWE DOLNE:
- { "pos" : [ -240, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -270, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -300, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -330, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -360, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -390, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -420, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -450, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -480, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -510, 338], "trait" : "goalPostBlue" },
- { "pos" : [ -540, 338], "trait" : "goalPostBlue" },
- // PACHOLKI DO STREF - PRAWE DOLNE:
- { "pos" : [ 240, 338], "trait" : "goalPostRed" },
- { "pos" : [ 270, 338], "trait" : "goalPostRed" },
- { "pos" : [ 300, 338], "trait" : "goalPostRed" },
- { "pos" : [ 330, 338], "trait" : "goalPostRed" },
- { "pos" : [ 360, 338], "trait" : "goalPostRed" },
- { "pos" : [ 390, 338], "trait" : "goalPostRed" },
- { "pos" : [ 420, 338], "trait" : "goalPostRed" },
- { "pos" : [ 450, 338], "trait" : "goalPostRed" },
- { "pos" : [ 480, 338], "trait" : "goalPostRed" },
- { "pos" : [ 510, 338], "trait" : "goalPostRed" },
- { "pos" : [ 540, 338], "trait" : "goalPostRed" },
- // PACHOLKI DO STREF - LEWE GORNE:
- { "pos" : [ -240, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -270, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -300, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -330, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -360, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -390, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -420, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -450, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -480, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -510, -338], "trait" : "goalPostBlue" },
- { "pos" : [ -540, -338], "trait" : "goalPostBlue" },
- // PACHOLKI DO STREF - PRAWE DOLNE:
- { "pos" : [ 240, -338], "trait" : "goalPostRed" },
- { "pos" : [ 270, -338], "trait" : "goalPostRed" },
- { "pos" : [ 300, -338], "trait" : "goalPostRed" },
- { "pos" : [ 330, -338], "trait" : "goalPostRed" },
- { "pos" : [ 360, -338], "trait" : "goalPostRed" },
- { "pos" : [ 390, -338], "trait" : "goalPostRed" },
- { "pos" : [ 420, -338], "trait" : "goalPostRed" },
- { "pos" : [ 450, -338], "trait" : "goalPostRed" },
- { "pos" : [ 480, -338], "trait" : "goalPostRed" },
- { "pos" : [ 510, -338], "trait" : "goalPostRed" },
- { "pos" : [ 540, -338], "trait" : "goalPostRed" }
- ],
- // List of planes:
- "planes" : [
- { "normal" : [0, 1], "dist" : -300, "trait" : "ballArea" }, // Top ball area wall.
- { "normal" : [0,-1], "dist" : -300, "trait" : "ballArea" }, // Bottom ball area wall.
- // Player bounds:
- { "normal" : [ 0, 1], "dist" : -370, "bCoef" : 0.1 }, // Top wall.
- { "normal" : [ 0,-1], "dist" : -370, "bCoef" : 0.1 }, // Bottom wall.
- { "normal" : [ 1, 0], "dist" : -670, "bCoef" : 0.1 }, // Left wall.
- { "normal" : [-1, 0], "dist" : -670, "bCoef" : 0.1 } // Right wall.
- ],
- // List of traits:
- "traits" : {
- "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball"]},
- "goalPostRed" : { "radius" : 4, "invMass" : 0, "bCoef" : 0.5, "color" : "e56e56" },
- "goalPostBlue" : { "radius" : 4, "invMass" : 0, "bCoef" : 0.5, "color" : "5689e5" },
- "goalNetRed" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball"], "curve" : 15, "color" : "ffecec" },
- "goalNetBlue" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball"], "curve" : 15, "color" : "dbe0ff" },
- "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO", "blueKO"], "cMask" : ["red", "blue"]},
- "rogBlue" : { "vis" : true, "curve" : 90, "color" : "dbe0ff", "cMask" : ["red"]},
- "rogRed" : { "vis" : true, "curve" : 90, "color" : "ffecec", "cMask" : ["blue"]},
- "roglineBlue" : { "vis" : true, "color" : "dbe0ff", "cMask" : ["red"]},
- "roglineRed" : { "vis" : true, "color" : "ffecec", "cMask" : ["blue"]},
- "linia" : { "vis" : true, "color" : "F6F6EF", "cMask" : ["none"]},
- "karne_red" : { "vis" : true, "color" : "F6F6EF", "cMask" : ["blue"]},
- "karne_blue" : { "vis" : true, "color" : "F6F6EF", "cMask" : ["red"]}
- }
- }
Add Comment
Please, Sign In to add comment