├── .babelrc
├── .gitignore
├── .parcelrc
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── index.html
├── package-lock.json
├── package.json
├── resource
├── Incredibots_Congratulations_1.png
├── Incredibots_Congratulations_2.png
├── Incredibots_Intro.mp3
├── Incredibots_Lose_r2.mp3
├── Incredibots_Win_r1.mp3
├── box120_bot.png
├── box120_mid.png
├── box120_top.png
├── box154_bot.png
├── box154_mid.png
├── box154_top.png
├── box200_bot.png
├── box200_mid.png
├── box200_top.png
├── box248_bot.png
├── box248_mid.png
├── box248_top.png
├── box547_bot.png
├── box547_mid.png
├── box547_top.png
├── button_X_base.png
├── button_X_click.png
├── button_X_roll.png
├── button_arrowdown_base.png
├── button_arrowdown_click.png
├── button_arrowdown_roll.png
├── button_arrowup_base.png
├── button_arrowup_click.png
├── button_arrowup_roll.png
├── button_blue_base.png
├── button_blue_click.png
├── button_blue_roll.png
├── button_orange_base.png
├── button_orange_click.png
├── button_orange_roll.png
├── button_pink_base.png
├── button_pink_click.png
├── button_pink_roll.png
├── button_play_base.png
├── button_play_click.png
├── button_play_roll.png
├── button_purple_base.png
├── button_purple_click.png
├── button_purple_roll.png
├── button_purplearrow_base.png
├── button_purplearrow_click.png
├── button_purplearrow_roll.png
├── button_red_base.png
├── button_red_click.png
├── button_red_roll.png
├── chall_ed_restrictions_box_L.png
├── chall_ed_restrictions_box_M.png
├── chall_ed_restrictions_box_R.png
├── chall_ed_winloss_box_L.png
├── chall_ed_winloss_box_M.png
├── chall_ed_winloss_box_R.png
├── chall_ed_winloss_box_linebox.png
├── chall_ed_winloss_box_linehoriz.png
├── chkboxA_base.png
├── chkboxA_click.png
├── chkboxA_disabled.png
├── chkboxA_roll.png
├── chkboxB_base.png
├── chkboxB_click.png
├── chkboxB_disabled.png
├── chkboxB_roll.png
├── click_02.mp3
├── cloud_0.png
├── cloud_1.png
├── cloud_2.png
├── cloud_3.png
├── cloud_4.png
├── cloud_5.png
├── cloud_6.png
├── cloud_7.png
├── cloud_8.png
├── cloud_9.png
├── create_joint_1.mp3
├── create_joint_2.mp3
├── create_joint_3.mp3
├── create_joint_4.mp3
├── create_joint_5.mp3
├── create_shape_1.mp3
├── create_shape_2.mp3
├── create_shape_3.mp3
├── create_shape_4.mp3
├── create_shape_5.mp3
├── incredibots2_logo.png
├── levelselect_box_1_L.png
├── levelselect_box_1_M.png
├── levelselect_box_1_R.png
├── levelselect_box_2_L.png
├── levelselect_box_2_M.png
├── levelselect_box_2_R.png
├── levelselect_box_other_L.png
├── levelselect_box_other_M.png
├── levelselect_box_other_R.png
├── levelselect_checkbox_levels_A.png
├── levelselect_checkbox_levels_B.png
├── levelselect_starthere_arrow.png
├── levelselect_starthere_text.png
├── listboxentry_active.png
├── listboxentry_base.png
├── listboxentry_roll.png
├── listboxentry_wide_active.png
├── listboxentry_wide_base.png
├── listboxentry_wide_roll.png
├── menubar.png
├── menubar_roll.png
├── menubox_chkboxA_base.png
├── menubox_chkboxA_click.png
├── menubox_chkboxA_roll.png
├── menubox_chkboxB_base.png
├── menubox_chkboxB_click.png
├── menubox_chkboxB_roll.png
├── mouse_hourglass.png
├── mouse_pointer.png
├── race.dat
├── replay.dat
├── robot.dat
├── roll_01.mp3
├── scrollbar_base.png
├── scrollbar_click.png
├── scrollbar_field.png
├── scrollbar_roll.png
├── scrollbar_tall_base.png
├── scrollbar_tall_click.png
├── scrollbar_tall_roll.png
├── slider_arrow.png
├── slider_groove.png
├── slider_groove_disabled.png
├── spaceship.dat
├── topbox_left.png
├── topbox_mid.png
├── topbox_right.png
├── txtbox_base.png
├── txtbox_base_disabled.png
└── txtbox_roll.png
├── site-resource
├── box_small.png
└── logo.png
├── src
├── Actions
│ ├── Action.ts
│ ├── CameraAction.ts
│ ├── ChangeSliderAction.ts
│ ├── ClearAction.ts
│ ├── ColourChangeAction.ts
│ ├── ControlKeyAction.ts
│ ├── CreateAction.ts
│ ├── DeleteAction.ts
│ ├── EnterTextAction.ts
│ ├── JointCheckboxAction.ts
│ ├── LimitChangeAction.ts
│ ├── MassCreateAction.ts
│ ├── MoveAction.ts
│ ├── MoveZAction.ts
│ ├── MultiCollideAction.ts
│ ├── MultiColourChangeAction.ts
│ ├── MultiFixateAction.ts
│ ├── MultiOutlineAction.ts
│ ├── MultiTerrainAction.ts
│ ├── MultiUndragableAction.ts
│ ├── ResizeShapesAction.ts
│ ├── ResizeTextAction.ts
│ ├── RotateAction.ts
│ ├── ShapeCheckboxAction.ts
│ ├── TextCheckboxAction.ts
│ └── TextSizeChangeAction.ts
├── Box2D
│ ├── Collision
│ │ ├── ClipVertex.ts
│ │ ├── Features.ts
│ │ ├── Shapes
│ │ │ ├── b2CircleDef.ts
│ │ │ ├── b2CircleShape.ts
│ │ │ ├── b2ConcaveArcDef.ts
│ │ │ ├── b2ConcaveArcShape.ts
│ │ │ ├── b2ConvexArcDef.ts
│ │ │ ├── b2ConvexArcShape.ts
│ │ │ ├── b2FilterData.ts
│ │ │ ├── b2MassData.ts
│ │ │ ├── b2PolygonDef.ts
│ │ │ ├── b2PolygonShape.ts
│ │ │ ├── b2Shape.ts
│ │ │ ├── b2ShapeDef.ts
│ │ │ ├── b2StaticEdgeChain.ts
│ │ │ ├── b2StaticEdgeChainDef.ts
│ │ │ └── b2StaticEdgeShape.ts
│ │ ├── b2AABB.ts
│ │ ├── b2Bound.ts
│ │ ├── b2BoundValues.ts
│ │ ├── b2BroadPhase.ts
│ │ ├── b2BufferedPair.ts
│ │ ├── b2Collision.ts
│ │ ├── b2ContactID.ts
│ │ ├── b2ContactPoint.ts
│ │ ├── b2Distance.ts
│ │ ├── b2DistanceRegister.ts
│ │ ├── b2Manifold.ts
│ │ ├── b2ManifoldPoint.ts
│ │ ├── b2OBB.ts
│ │ ├── b2Pair.ts
│ │ ├── b2PairCallback.ts
│ │ ├── b2PairManager.ts
│ │ ├── b2Point.ts
│ │ ├── b2Proxy.ts
│ │ ├── b2Segment.ts
│ │ └── b2TimeOfImpact.ts
│ ├── Common
│ │ ├── Math
│ │ │ ├── b2Mat22.ts
│ │ │ ├── b2Math.ts
│ │ │ ├── b2Sweep.ts
│ │ │ ├── b2Vec2.ts
│ │ │ └── b2XForm.ts
│ │ ├── b2Color.ts
│ │ └── b2Settings.ts
│ ├── Dynamics
│ │ ├── Contacts
│ │ │ ├── b2CircleContact.ts
│ │ │ ├── b2ConcaveArcAndCircleContact.ts
│ │ │ ├── b2Contact.ts
│ │ │ ├── b2ContactConstraint.ts
│ │ │ ├── b2ContactConstraintPoint.ts
│ │ │ ├── b2ContactEdge.ts
│ │ │ ├── b2ContactRegister.ts
│ │ │ ├── b2ContactResult.ts
│ │ │ ├── b2ContactSolver.ts
│ │ │ ├── b2NullContact.ts
│ │ │ ├── b2PolyAndCircleContact.ts
│ │ │ ├── b2PolyAndConcaveArcContact.ts
│ │ │ ├── b2PolyAndStaticEdgeContact.ts
│ │ │ ├── b2PolygonContact.ts
│ │ │ └── b2StaticEdgeAndCircleContact.ts
│ │ ├── Joints
│ │ │ ├── b2DistanceJoint.ts
│ │ │ ├── b2DistanceJointDef.ts
│ │ │ ├── b2GearJoint.ts
│ │ │ ├── b2GearJointDef.ts
│ │ │ ├── b2Jacobian.ts
│ │ │ ├── b2Joint.ts
│ │ │ ├── b2JointDef.ts
│ │ │ ├── b2JointEdge.ts
│ │ │ ├── b2MouseJoint.ts
│ │ │ ├── b2MouseJointDef.ts
│ │ │ ├── b2PrismaticJoint.ts
│ │ │ ├── b2PrismaticJointDef.ts
│ │ │ ├── b2PulleyJoint.ts
│ │ │ ├── b2PulleyJointDef.ts
│ │ │ ├── b2RevoluteJoint.ts
│ │ │ └── b2RevoluteJointDef.ts
│ │ ├── b2Body.ts
│ │ ├── b2BodyDef.ts
│ │ ├── b2BoundaryListener.ts
│ │ ├── b2ContactFilter.ts
│ │ ├── b2ContactListener.ts
│ │ ├── b2ContactManager.ts
│ │ ├── b2DebugDraw.ts
│ │ ├── b2DestructionListener.ts
│ │ ├── b2Island.ts
│ │ ├── b2TimeStep.ts
│ │ └── b2World.ts
│ └── index.ts
├── Game
│ ├── CameraMovement.ts
│ ├── Challenge.ts
│ ├── Challenges
│ │ ├── ControllerClimb.ts
│ │ ├── ControllerMonkeyBars.ts
│ │ ├── ControllerRace.ts
│ │ └── ControllerSpaceship.ts
│ ├── Condition.ts
│ ├── ContactFilter.ts
│ ├── ContactListener.ts
│ ├── Controller.ts
│ ├── ControllerChallenge.ts
│ ├── ControllerGame.ts
│ ├── ControllerMainMenu.ts
│ ├── ControllerSandbox.ts
│ ├── Draw.ts
│ ├── Globals
│ │ └── ControllerGameGlobals.ts
│ ├── Graphics
│ │ ├── Gradient.ts
│ │ ├── Resource.ts
│ │ ├── Sky.ts
│ │ └── b2DebugDraw.ts
│ ├── KeyPress.ts
│ ├── LossCondition.ts
│ ├── Replay.ts
│ ├── ReplaySyncPoint.ts
│ ├── Robot.ts
│ ├── SandboxSettings.ts
│ ├── Tutorials
│ │ ├── ControllerCar.ts
│ │ ├── ControllerCatapult.ts
│ │ ├── ControllerChallengeEditor.ts
│ │ ├── ControllerDumpbot.ts
│ │ ├── ControllerHomeMovies.ts
│ │ ├── ControllerJumpbot.ts
│ │ ├── ControllerNewFeatures.ts
│ │ ├── ControllerRubeGoldberg.ts
│ │ ├── ControllerShapes.ts
│ │ ├── ControllerTank.ts
│ │ └── ControllerTutorial.ts
│ └── WinCondition.ts
├── General
│ ├── AMF
│ │ ├── AMF0.js
│ │ ├── AMF3.js
│ │ └── AMFalternatives.md
│ ├── ByteArray.ts
│ ├── ByteArrayEnums.ts
│ ├── Database.ts
│ ├── FRateLimiter.as
│ ├── FpsCounter.ts
│ ├── Input.ts
│ ├── LSOManager.ts
│ ├── LZW.as
│ ├── MD5.as
│ └── Util.ts
├── Gui
│ ├── AdvancedSandboxWindow.ts
│ ├── ChooseChallengeWindow.as
│ ├── ColourChangeWindow.ts
│ ├── ConditionsWindow.ts
│ ├── DialogWindow.ts
│ ├── DropDownMenu.ts
│ ├── DropDownMenuItem.ts
│ ├── ExportWindow.ts
│ ├── GoldLoginWindow.as
│ ├── GuiButton.ts
│ ├── GuiCheckBox.ts
│ ├── GuiCombobox.ts
│ ├── GuiComboboxItem.ts
│ ├── GuiList.ts
│ ├── GuiSlider.ts
│ ├── GuiTextArea.ts
│ ├── GuiTextInput.as
│ ├── GuiTextInput.ts
│ ├── GuiWindow.ts
│ ├── ImportWindow.ts
│ ├── LinkWindow.as
│ ├── LoadWindow.ts
│ ├── LoginWindow.as
│ ├── MainEditPanel.ts
│ ├── MainMenuButton.as
│ ├── MyCellRenderer.as
│ ├── MyWideCellRenderer.as
│ ├── NewUserWindow.as
│ ├── PartEditWindow.ts
│ ├── PostReplayWindow.ts
│ ├── RateWindow.as
│ ├── ReportWindow.as
│ ├── RestrictionsWindow.ts
│ ├── SaveLoadWindow.as
│ ├── ScoreWindow.ts
│ ├── SearchWindow.as
│ ├── TermsWindow.as
│ ├── TutorialSelectWindow.ts
│ └── TutorialWindow.ts
├── Main.ts
├── Parts
│ ├── Cannon.ts
│ ├── Circle.ts
│ ├── FixedJoint.ts
│ ├── JointPart.ts
│ ├── Part.ts
│ ├── PrismaticJoint.ts
│ ├── Rectangle.ts
│ ├── RevoluteJoint.ts
│ ├── ShapePart.ts
│ ├── TextPart.ts
│ ├── Thrusters.ts
│ └── Triangle.ts
├── imports.ts
├── index.ts
└── mx
│ └── utils
│ ├── Base64Decoder.ts
│ ├── Base64Encoder.ts
│ └── UIDUtil.as
└── tsconfig.json
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["@babel/preset-typescript", {
4 | "targets": ["last 1 Chrome version"],
5 | "shippedProposals": true
6 | }]
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/.parcelrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@parcel/config-default",
3 | "transformers": {
4 | "*.dat": ["@parcel/transformer-raw"],
5 | "*.mp3": ["@parcel/transformer-raw"]
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010 IncrediFriends
2 |
3 | The included files (the "Software") are provided and distributed free of
4 | charge and must be distributed in an equal or similar latest license as
5 | this software. The old copyright and license below refers to the original
6 | open-source files released prior to this and any other "Jaybit"
7 | release and does not affect this release's lack of source code
8 | availability. Disclaimers of the original license still remain.
9 |
10 | This may only be distributed if the following conditions are met:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | The distribution is provided free of charge and of the same or similar
16 | license as this release.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 | Disclaimer: IncrediFriends is in no way associated with Big Fish Games Inc.,
27 | is not liable, and assumes no responsibility for any content, sites, or
28 | forums that has not been explicitly claimed or noted by the administrators of
29 | IncrediFriends.
30 |
31 | Copyright (c) 2010 Big Fish Games Inc.
32 |
33 | Permission is hereby granted, free of charge, to any person obtaining a copy
34 | of this software and associated documentation files (the "Software"), to deal
35 | in the Software without restriction, including without limitation the rights
36 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37 | copies of the Software, and to permit persons to whom the Software is
38 | furnished to do so, subject to the following conditions:
39 |
40 | The above copyright notice and this permission notice shall be included in
41 | all copies or substantial portions of the Software.
42 |
43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
49 | THE SOFTWARE.
50 |
51 | Disclaimer: Big Fish Games is not affiliated with, does not endorse, cannot
52 | control the activities of, and assumes no responsibility or liability for,
53 | any forums, content, sites or software connected with or relating to Incredibots.
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Incredibots 2 HTML5 Open Source
8 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | Loading assets...
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "dev": "parcel serve index.html",
4 | "build": "parcel build index.html --public-url /Incredibots-2-HTML5-Open-Source/ --no-optimize --no-scope-hoist",
5 | "deploy": "gh-pages -d dist"
6 | },
7 | "browserslist": [
8 | "last 1 chrome version"
9 | ],
10 | "dependencies": {
11 | "box2d": "^1.0.0",
12 | "bytearray-node": "^3.3.5",
13 | "iconv-lite": "^0.6.2",
14 | "lzma": "^2.3.2",
15 | "pixi-scrollbox": "^2.3.1",
16 | "pixi-sound": "^3.0.5",
17 | "pixi-text-input": "^1.0.5",
18 | "pixi-viewport": "^4.32.0",
19 | "pixi.js": "^6.1.2"
20 | },
21 | "devDependencies": {
22 | "@babel/core": "^7.15",
23 | "@babel/preset-env": "^7.15",
24 | "@babel/preset-typescript": "^7.15.0",
25 | "@parcel/transformer-image": "^2.0.0-rc.0",
26 | "@parcel/transformer-raw": "^2.0.0-rc.0",
27 | "gh-pages": "^3.1.0",
28 | "parcel": "^2.0.0-rc.0",
29 | "typescript": "^4.1.3"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/resource/Incredibots_Congratulations_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/Incredibots_Congratulations_1.png
--------------------------------------------------------------------------------
/resource/Incredibots_Congratulations_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/Incredibots_Congratulations_2.png
--------------------------------------------------------------------------------
/resource/Incredibots_Intro.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/Incredibots_Intro.mp3
--------------------------------------------------------------------------------
/resource/Incredibots_Lose_r2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/Incredibots_Lose_r2.mp3
--------------------------------------------------------------------------------
/resource/Incredibots_Win_r1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/Incredibots_Win_r1.mp3
--------------------------------------------------------------------------------
/resource/box120_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box120_bot.png
--------------------------------------------------------------------------------
/resource/box120_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box120_mid.png
--------------------------------------------------------------------------------
/resource/box120_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box120_top.png
--------------------------------------------------------------------------------
/resource/box154_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box154_bot.png
--------------------------------------------------------------------------------
/resource/box154_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box154_mid.png
--------------------------------------------------------------------------------
/resource/box154_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box154_top.png
--------------------------------------------------------------------------------
/resource/box200_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box200_bot.png
--------------------------------------------------------------------------------
/resource/box200_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box200_mid.png
--------------------------------------------------------------------------------
/resource/box200_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box200_top.png
--------------------------------------------------------------------------------
/resource/box248_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box248_bot.png
--------------------------------------------------------------------------------
/resource/box248_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box248_mid.png
--------------------------------------------------------------------------------
/resource/box248_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box248_top.png
--------------------------------------------------------------------------------
/resource/box547_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box547_bot.png
--------------------------------------------------------------------------------
/resource/box547_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box547_mid.png
--------------------------------------------------------------------------------
/resource/box547_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/box547_top.png
--------------------------------------------------------------------------------
/resource/button_X_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_X_base.png
--------------------------------------------------------------------------------
/resource/button_X_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_X_click.png
--------------------------------------------------------------------------------
/resource/button_X_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_X_roll.png
--------------------------------------------------------------------------------
/resource/button_arrowdown_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowdown_base.png
--------------------------------------------------------------------------------
/resource/button_arrowdown_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowdown_click.png
--------------------------------------------------------------------------------
/resource/button_arrowdown_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowdown_roll.png
--------------------------------------------------------------------------------
/resource/button_arrowup_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowup_base.png
--------------------------------------------------------------------------------
/resource/button_arrowup_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowup_click.png
--------------------------------------------------------------------------------
/resource/button_arrowup_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_arrowup_roll.png
--------------------------------------------------------------------------------
/resource/button_blue_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_blue_base.png
--------------------------------------------------------------------------------
/resource/button_blue_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_blue_click.png
--------------------------------------------------------------------------------
/resource/button_blue_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_blue_roll.png
--------------------------------------------------------------------------------
/resource/button_orange_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_orange_base.png
--------------------------------------------------------------------------------
/resource/button_orange_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_orange_click.png
--------------------------------------------------------------------------------
/resource/button_orange_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_orange_roll.png
--------------------------------------------------------------------------------
/resource/button_pink_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_pink_base.png
--------------------------------------------------------------------------------
/resource/button_pink_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_pink_click.png
--------------------------------------------------------------------------------
/resource/button_pink_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_pink_roll.png
--------------------------------------------------------------------------------
/resource/button_play_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_play_base.png
--------------------------------------------------------------------------------
/resource/button_play_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_play_click.png
--------------------------------------------------------------------------------
/resource/button_play_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_play_roll.png
--------------------------------------------------------------------------------
/resource/button_purple_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purple_base.png
--------------------------------------------------------------------------------
/resource/button_purple_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purple_click.png
--------------------------------------------------------------------------------
/resource/button_purple_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purple_roll.png
--------------------------------------------------------------------------------
/resource/button_purplearrow_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purplearrow_base.png
--------------------------------------------------------------------------------
/resource/button_purplearrow_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purplearrow_click.png
--------------------------------------------------------------------------------
/resource/button_purplearrow_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_purplearrow_roll.png
--------------------------------------------------------------------------------
/resource/button_red_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_red_base.png
--------------------------------------------------------------------------------
/resource/button_red_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_red_click.png
--------------------------------------------------------------------------------
/resource/button_red_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/button_red_roll.png
--------------------------------------------------------------------------------
/resource/chall_ed_restrictions_box_L.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_restrictions_box_L.png
--------------------------------------------------------------------------------
/resource/chall_ed_restrictions_box_M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_restrictions_box_M.png
--------------------------------------------------------------------------------
/resource/chall_ed_restrictions_box_R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_restrictions_box_R.png
--------------------------------------------------------------------------------
/resource/chall_ed_winloss_box_L.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_winloss_box_L.png
--------------------------------------------------------------------------------
/resource/chall_ed_winloss_box_M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_winloss_box_M.png
--------------------------------------------------------------------------------
/resource/chall_ed_winloss_box_R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_winloss_box_R.png
--------------------------------------------------------------------------------
/resource/chall_ed_winloss_box_linebox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_winloss_box_linebox.png
--------------------------------------------------------------------------------
/resource/chall_ed_winloss_box_linehoriz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chall_ed_winloss_box_linehoriz.png
--------------------------------------------------------------------------------
/resource/chkboxA_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxA_base.png
--------------------------------------------------------------------------------
/resource/chkboxA_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxA_click.png
--------------------------------------------------------------------------------
/resource/chkboxA_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxA_disabled.png
--------------------------------------------------------------------------------
/resource/chkboxA_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxA_roll.png
--------------------------------------------------------------------------------
/resource/chkboxB_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxB_base.png
--------------------------------------------------------------------------------
/resource/chkboxB_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxB_click.png
--------------------------------------------------------------------------------
/resource/chkboxB_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxB_disabled.png
--------------------------------------------------------------------------------
/resource/chkboxB_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/chkboxB_roll.png
--------------------------------------------------------------------------------
/resource/click_02.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/click_02.mp3
--------------------------------------------------------------------------------
/resource/cloud_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_0.png
--------------------------------------------------------------------------------
/resource/cloud_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_1.png
--------------------------------------------------------------------------------
/resource/cloud_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_2.png
--------------------------------------------------------------------------------
/resource/cloud_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_3.png
--------------------------------------------------------------------------------
/resource/cloud_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_4.png
--------------------------------------------------------------------------------
/resource/cloud_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_5.png
--------------------------------------------------------------------------------
/resource/cloud_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_6.png
--------------------------------------------------------------------------------
/resource/cloud_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_7.png
--------------------------------------------------------------------------------
/resource/cloud_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_8.png
--------------------------------------------------------------------------------
/resource/cloud_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/cloud_9.png
--------------------------------------------------------------------------------
/resource/create_joint_1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_joint_1.mp3
--------------------------------------------------------------------------------
/resource/create_joint_2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_joint_2.mp3
--------------------------------------------------------------------------------
/resource/create_joint_3.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_joint_3.mp3
--------------------------------------------------------------------------------
/resource/create_joint_4.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_joint_4.mp3
--------------------------------------------------------------------------------
/resource/create_joint_5.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_joint_5.mp3
--------------------------------------------------------------------------------
/resource/create_shape_1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_shape_1.mp3
--------------------------------------------------------------------------------
/resource/create_shape_2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_shape_2.mp3
--------------------------------------------------------------------------------
/resource/create_shape_3.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_shape_3.mp3
--------------------------------------------------------------------------------
/resource/create_shape_4.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_shape_4.mp3
--------------------------------------------------------------------------------
/resource/create_shape_5.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/create_shape_5.mp3
--------------------------------------------------------------------------------
/resource/incredibots2_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/incredibots2_logo.png
--------------------------------------------------------------------------------
/resource/levelselect_box_1_L.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_1_L.png
--------------------------------------------------------------------------------
/resource/levelselect_box_1_M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_1_M.png
--------------------------------------------------------------------------------
/resource/levelselect_box_1_R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_1_R.png
--------------------------------------------------------------------------------
/resource/levelselect_box_2_L.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_2_L.png
--------------------------------------------------------------------------------
/resource/levelselect_box_2_M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_2_M.png
--------------------------------------------------------------------------------
/resource/levelselect_box_2_R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_2_R.png
--------------------------------------------------------------------------------
/resource/levelselect_box_other_L.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_other_L.png
--------------------------------------------------------------------------------
/resource/levelselect_box_other_M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_other_M.png
--------------------------------------------------------------------------------
/resource/levelselect_box_other_R.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_box_other_R.png
--------------------------------------------------------------------------------
/resource/levelselect_checkbox_levels_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_checkbox_levels_A.png
--------------------------------------------------------------------------------
/resource/levelselect_checkbox_levels_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_checkbox_levels_B.png
--------------------------------------------------------------------------------
/resource/levelselect_starthere_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_starthere_arrow.png
--------------------------------------------------------------------------------
/resource/levelselect_starthere_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/levelselect_starthere_text.png
--------------------------------------------------------------------------------
/resource/listboxentry_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_active.png
--------------------------------------------------------------------------------
/resource/listboxentry_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_base.png
--------------------------------------------------------------------------------
/resource/listboxentry_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_roll.png
--------------------------------------------------------------------------------
/resource/listboxentry_wide_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_wide_active.png
--------------------------------------------------------------------------------
/resource/listboxentry_wide_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_wide_base.png
--------------------------------------------------------------------------------
/resource/listboxentry_wide_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/listboxentry_wide_roll.png
--------------------------------------------------------------------------------
/resource/menubar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubar.png
--------------------------------------------------------------------------------
/resource/menubar_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubar_roll.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxA_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxA_base.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxA_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxA_click.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxA_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxA_roll.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxB_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxB_base.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxB_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxB_click.png
--------------------------------------------------------------------------------
/resource/menubox_chkboxB_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/menubox_chkboxB_roll.png
--------------------------------------------------------------------------------
/resource/mouse_hourglass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/mouse_hourglass.png
--------------------------------------------------------------------------------
/resource/mouse_pointer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/mouse_pointer.png
--------------------------------------------------------------------------------
/resource/race.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/race.dat
--------------------------------------------------------------------------------
/resource/replay.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/replay.dat
--------------------------------------------------------------------------------
/resource/robot.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/robot.dat
--------------------------------------------------------------------------------
/resource/roll_01.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/roll_01.mp3
--------------------------------------------------------------------------------
/resource/scrollbar_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_base.png
--------------------------------------------------------------------------------
/resource/scrollbar_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_click.png
--------------------------------------------------------------------------------
/resource/scrollbar_field.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_field.png
--------------------------------------------------------------------------------
/resource/scrollbar_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_roll.png
--------------------------------------------------------------------------------
/resource/scrollbar_tall_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_tall_base.png
--------------------------------------------------------------------------------
/resource/scrollbar_tall_click.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_tall_click.png
--------------------------------------------------------------------------------
/resource/scrollbar_tall_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/scrollbar_tall_roll.png
--------------------------------------------------------------------------------
/resource/slider_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/slider_arrow.png
--------------------------------------------------------------------------------
/resource/slider_groove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/slider_groove.png
--------------------------------------------------------------------------------
/resource/slider_groove_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/slider_groove_disabled.png
--------------------------------------------------------------------------------
/resource/spaceship.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/spaceship.dat
--------------------------------------------------------------------------------
/resource/topbox_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/topbox_left.png
--------------------------------------------------------------------------------
/resource/topbox_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/topbox_mid.png
--------------------------------------------------------------------------------
/resource/topbox_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/topbox_right.png
--------------------------------------------------------------------------------
/resource/txtbox_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/txtbox_base.png
--------------------------------------------------------------------------------
/resource/txtbox_base_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/txtbox_base_disabled.png
--------------------------------------------------------------------------------
/resource/txtbox_roll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/resource/txtbox_roll.png
--------------------------------------------------------------------------------
/site-resource/box_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/site-resource/box_small.png
--------------------------------------------------------------------------------
/site-resource/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/d85bf70a5efe9a89b977135d1ccb3a9f142fd164/site-resource/logo.png
--------------------------------------------------------------------------------
/src/Actions/Action.ts:
--------------------------------------------------------------------------------
1 | import { ControllerGame } from "../imports";
2 | import { IllegalOperationError, Part } from "../imports";
3 |
4 | export class Action {
5 | public static m_controller:ControllerGame;
6 |
7 | public partAffected:Part;
8 |
9 | constructor(p:Part) {
10 | this.partAffected = p;
11 | }
12 |
13 | public UndoAction():void {
14 | throw new IllegalOperationError("abstract Action.UndoAction() called");
15 | }
16 |
17 | public RedoAction():void {
18 | throw new IllegalOperationError("abstract Action.RedoAction() called");
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/src/Actions/CameraAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { ShapePart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class CameraAction extends Action
6 | {
7 | private isChecked:boolean;
8 | private oldCameraPart:ShapePart|null
9 |
10 | constructor(p:Part, checked:boolean, oldPart:ShapePart|null = null)
11 | {
12 | super(p);
13 | this.isChecked = checked;
14 | this.oldCameraPart = oldPart;
15 | }
16 |
17 | public UndoAction():void {
18 | (this.partAffected as ShapePart).isCameraFocus = !this.isChecked;
19 | if (this.oldCameraPart) this.oldCameraPart.isCameraFocus = true;
20 | }
21 |
22 | public RedoAction():void {
23 | (this.partAffected as ShapePart).isCameraFocus = this.isChecked;
24 | if (this.oldCameraPart) this.oldCameraPart.isCameraFocus = false;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/ChangeSliderAction.ts:
--------------------------------------------------------------------------------
1 | import { Cannon } from "../imports";
2 | import { Part } from "../imports";
3 | import { PrismaticJoint } from "../imports";
4 | import { RevoluteJoint } from "../imports";
5 | import { ShapePart } from "../imports";
6 | import { Thrusters } from "../imports";
7 | import { Action } from "../imports";
8 |
9 | export class ChangeSliderAction extends Action
10 | {
11 | public static DENSITY_TYPE:number = 0;
12 | public static STRENGTH_TYPE:number = 1;
13 | public static SPEED_TYPE:number = 2;
14 |
15 | private change:number;
16 | private type:number;
17 |
18 | constructor(p:Part, sliderType:number, deltaVal:number)
19 | {
20 | super(p);
21 | this.type = sliderType;
22 | this.change = deltaVal;
23 | }
24 |
25 | public UndoAction():void {
26 | if (this.type == ChangeSliderAction.DENSITY_TYPE) {
27 | (this.partAffected as ShapePart).density -= this.change;
28 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof RevoluteJoint) {
29 | (this.partAffected as RevoluteJoint).motorStrength -= this.change;
30 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof PrismaticJoint) {
31 | (this.partAffected as PrismaticJoint).pistonStrength -= this.change;
32 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof Thrusters) {
33 | (this.partAffected as Thrusters).strength -= this.change;
34 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof Cannon) {
35 | (this.partAffected as Cannon).strength -= this.change;
36 | } else if (this.type == ChangeSliderAction.SPEED_TYPE && this.partAffected instanceof RevoluteJoint) {
37 | (this.partAffected as RevoluteJoint).motorSpeed -= this.change;
38 | } else {
39 | (this.partAffected as PrismaticJoint).pistonSpeed -= this.change;
40 | }
41 | }
42 |
43 | public RedoAction():void {
44 | if (this.type == ChangeSliderAction.DENSITY_TYPE) {
45 | (this.partAffected as ShapePart).density += this.change;
46 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof RevoluteJoint) {
47 | (this.partAffected as RevoluteJoint).motorStrength += this.change;
48 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof PrismaticJoint) {
49 | (this.partAffected as PrismaticJoint).pistonStrength += this.change;
50 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof Thrusters) {
51 | (this.partAffected as Thrusters).strength += this.change;
52 | } else if (this.type == ChangeSliderAction.STRENGTH_TYPE && this.partAffected instanceof Cannon) {
53 | (this.partAffected as Cannon).strength += this.change;
54 | } else if (this.type == ChangeSliderAction.SPEED_TYPE && this.partAffected instanceof RevoluteJoint) {
55 | (this.partAffected as RevoluteJoint).motorSpeed += this.change;
56 | } else {
57 | (this.partAffected as PrismaticJoint).pistonSpeed += this.change;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/Actions/ClearAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class ClearAction extends Action
4 | {
5 | private parts:Array;
6 |
7 | constructor(clearedParts:Array)
8 | {
9 | super(clearedParts[0]);
10 | this.parts = clearedParts;
11 | }
12 |
13 | public UndoAction():void {
14 | for (var i:number = 0; i < this.parts.length; i++) {
15 | ClearAction.m_controller.allParts.push(this.parts[i]);
16 | this.parts[i].isEnabled = true;
17 | }
18 | }
19 |
20 | public RedoAction():void {
21 | for (var i:number = 0; i < this.parts.length; i++) {
22 | ClearAction.m_controller.DeletePart(this.parts[i], false);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Actions/ColourChangeAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { PrismaticJoint } from "../imports";
3 | import { ShapePart } from "../imports";
4 | import { TextPart } from "../imports";
5 | import { Action } from "../imports";
6 |
7 | export class ColourChangeAction extends Action
8 | {
9 | private red:number;
10 | private green:number;
11 | private blue:number;
12 | private opacity:number;
13 |
14 | constructor(p:Part, deltaRed:number, deltaGreen:number, deltaBlue:number, deltaOpacity:number)
15 | {
16 | super(p);
17 | this.red = deltaRed;
18 | this.green = deltaGreen;
19 | this.blue = deltaBlue;
20 | this.opacity = deltaOpacity;
21 | }
22 |
23 | public UndoAction():void {
24 | if (this.partAffected instanceof ShapePart || this.partAffected instanceof PrismaticJoint || this.partAffected instanceof TextPart) {
25 | (this.partAffected as Object).red -= this.red;
26 | (this.partAffected as Object).green -= this.green;
27 | (this.partAffected as Object).blue -= this.blue;
28 | if (!(this.partAffected instanceof TextPart)) (this.partAffected as Object).opacity -= this.opacity;
29 | }
30 | }
31 |
32 | public RedoAction():void {
33 | if (this.partAffected instanceof ShapePart || this.partAffected instanceof PrismaticJoint || this.partAffected instanceof TextPart) {
34 | (this.partAffected as Object).red += this.red;
35 | (this.partAffected as Object).green += this.green;
36 | (this.partAffected as Object).blue += this.blue;
37 | if (!(this.partAffected instanceof TextPart)) (this.partAffected as Object).opacity += this.opacity;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Actions/ControlKeyAction.ts:
--------------------------------------------------------------------------------
1 | import { Cannon } from "../imports";
2 | import { Part } from "../imports";
3 | import { PrismaticJoint } from "../imports";
4 | import { RevoluteJoint } from "../imports";
5 | import { TextPart } from "../imports";
6 | import { Thrusters } from "../imports";
7 | import { Action } from "../imports";
8 |
9 | export class ControlKeyAction extends Action
10 | {
11 | public static CW_TYPE:number = 0;
12 | public static CCW_TYPE:number = 1;
13 | public static EXPAND_TYPE:number = 2;
14 | public static CONTRACT_TYPE:number = 3;
15 | public static TEXT_TYPE:number = 4;
16 | public static THRUSTERS_TYPE:number = 5;
17 | public static CANNON_TYPE:number = 6;
18 |
19 | private type:number;
20 | private oldKey:number;
21 | private newKey:number;
22 |
23 | constructor(p:Part, keyType:number, oldVal:number, newVal:number)
24 | {
25 | super(p);
26 | this.type = keyType;
27 | this.oldKey = oldVal;
28 | this.newKey = newVal;
29 | }
30 |
31 | public UndoAction():void {
32 | if (this.type == ControlKeyAction.CW_TYPE) {
33 | (this.partAffected as RevoluteJoint).motorCWKey = this.oldKey;
34 | } else if (this.type == ControlKeyAction.CCW_TYPE) {
35 | (this.partAffected as RevoluteJoint).motorCCWKey = this.oldKey;
36 | } else if (this.type == ControlKeyAction.EXPAND_TYPE) {
37 | (this.partAffected as PrismaticJoint).pistonUpKey = this.oldKey;
38 | } else if (this.type == ControlKeyAction.CONTRACT_TYPE) {
39 | (this.partAffected as PrismaticJoint).pistonDownKey = this.oldKey;
40 | } else if (this.type == ControlKeyAction.TEXT_TYPE) {
41 | (this.partAffected as TextPart).displayKey = this.oldKey;
42 | } else if (this.type == ControlKeyAction.THRUSTERS_TYPE) {
43 | (this.partAffected as Thrusters).thrustKey = this.oldKey;
44 | } else if (this.type == ControlKeyAction.CANNON_TYPE) {
45 | (this.partAffected as Cannon).fireKey = this.oldKey;
46 | }
47 | }
48 |
49 | public RedoAction():void {
50 | if (this.type == ControlKeyAction.CW_TYPE) {
51 | (this.partAffected as RevoluteJoint).motorCWKey = this.newKey;
52 | } else if (this.type == ControlKeyAction.CCW_TYPE) {
53 | (this.partAffected as RevoluteJoint).motorCCWKey = this.newKey;
54 | } else if (this.type == ControlKeyAction.EXPAND_TYPE) {
55 | (this.partAffected as PrismaticJoint).pistonUpKey = this.newKey;
56 | } else if (this.type == ControlKeyAction.CONTRACT_TYPE) {
57 | (this.partAffected as PrismaticJoint).pistonDownKey = this.newKey;
58 | } else if (this.type == ControlKeyAction.TEXT_TYPE) {
59 | (this.partAffected as TextPart).displayKey = this.newKey;
60 | } else if (this.type == ControlKeyAction.THRUSTERS_TYPE) {
61 | (this.partAffected as Thrusters).thrustKey = this.newKey;
62 | } else if (this.type == ControlKeyAction.CANNON_TYPE) {
63 | (this.partAffected as Cannon).fireKey = this.oldKey;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/Actions/CreateAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { Action } from "../imports";
3 |
4 | export class CreateAction extends Action
5 | {
6 | constructor(p:Part)
7 | {
8 | super(p);
9 | }
10 |
11 | public UndoAction():void {
12 | CreateAction.m_controller.DeletePart(this.partAffected, false);
13 | }
14 |
15 | public RedoAction():void {
16 | CreateAction.m_controller.allParts.push(this.partAffected);
17 | this.partAffected.isEnabled = true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Actions/DeleteAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { Action } from "../imports";
3 |
4 | export class DeleteAction extends Action
5 | {
6 | private joints:Array;
7 |
8 | constructor(p:Part, affectedJoints:Array)
9 | {
10 | super(p);
11 | this.joints = affectedJoints;
12 | }
13 |
14 | public UndoAction():void {
15 | DeleteAction.m_controller.allParts.push(this.partAffected);
16 | for (var i:number = 0; i < this.joints.length; i++) {
17 | DeleteAction.m_controller.allParts.push(this.joints[i]);
18 | this.joints[i].isEnabled = true;
19 | }
20 | this.partAffected.isEnabled = true;
21 | }
22 |
23 | public RedoAction():void {
24 | DeleteAction.m_controller.DeletePart(this.partAffected, false);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/EnterTextAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { TextPart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class EnterTextAction extends Action
6 | {
7 | private oldText:string;
8 | private newText:string;
9 |
10 | constructor(p:Part, oldVal:string, newVal:string)
11 | {
12 | super(p);
13 | this.oldText = oldVal;
14 | this.newText = newVal;
15 | }
16 |
17 | public UndoAction():void {
18 | (this.partAffected as TextPart).text = this.oldText;
19 | }
20 |
21 | public RedoAction():void {
22 | (this.partAffected as TextPart).text = this.newText;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Actions/LimitChangeAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { RevoluteJoint } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class LimitChangeAction extends Action
6 | {
7 | public static MIN_TYPE:number = 0;
8 | public static MAX_TYPE:number = 1;
9 |
10 | private type:number;
11 | private oldLimit:number;
12 | private newLimit:number;
13 |
14 | constructor(p:Part, limitType:number, oldVal:number, newVal:number)
15 | {
16 | super(p);
17 | this.type = limitType;
18 | this.oldLimit = oldVal;
19 | this.newLimit = newVal;
20 | }
21 |
22 | public UndoAction():void {
23 | if (this.type == LimitChangeAction.MIN_TYPE) {
24 | (this.partAffected as RevoluteJoint).motorLowerLimit = this.oldLimit;
25 | } else {
26 | (this.partAffected as RevoluteJoint).motorUpperLimit = this.oldLimit;
27 | }
28 | }
29 |
30 | public RedoAction():void {
31 | if (this.type == LimitChangeAction.MIN_TYPE) {
32 | (this.partAffected as RevoluteJoint).motorLowerLimit = this.newLimit;
33 | } else {
34 | (this.partAffected as RevoluteJoint).motorUpperLimit = this.newLimit;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Actions/MassCreateAction.ts:
--------------------------------------------------------------------------------
1 | import { ShapePart } from "../imports";
2 | import { TextPart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class MassCreateAction extends Action
6 | {
7 | private parts:Array;
8 |
9 | constructor(createdParts:Array)
10 | {
11 | super(createdParts[0]);
12 | this.parts = createdParts;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.parts.length; i++) {
17 | if (this.parts[i] instanceof ShapePart || this.parts[i] instanceof TextPart) {
18 | MassCreateAction.m_controller.DeletePart(this.parts[i], false);
19 | }
20 | }
21 | }
22 |
23 | public RedoAction():void {
24 | for (var i:number = 0; i < this.parts.length; i++) {
25 | MassCreateAction.m_controller.allParts.push(this.parts[i]);
26 | this.parts[i].isEnabled = true;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Actions/MoveAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { ShapePart } from "../imports";
3 | import { TextPart } from "../imports";
4 | import { Thrusters } from "../imports";
5 | import { Action } from "../imports";
6 |
7 | export class MoveAction extends Action
8 | {
9 | private movedParts:Array;
10 | private xMove:number;
11 | private yMove:number;
12 |
13 | constructor(p:Part, attachedParts:Array, deltaX:number, deltaY:number) {
14 | super(p);
15 | this.xMove = deltaX;
16 | this.yMove = deltaY;
17 | this.movedParts = attachedParts;
18 | }
19 |
20 | public UndoAction():void {
21 | for (var i:number = 0; i < this.movedParts.length; i++) {
22 | if (this.movedParts[i] instanceof ShapePart || this.movedParts[i] instanceof Thrusters) {
23 | this.movedParts[i].Move(this.movedParts[i].centerX - this.xMove, this.movedParts[i].centerY - this.yMove);
24 | } else if (this.movedParts[i] instanceof TextPart) {
25 | this.movedParts[i].Move(this.movedParts[i].x - this.xMove, this.movedParts[i].y - this.yMove);
26 | } else {
27 | this.movedParts[i].Move(this.movedParts[i].anchorX - this.xMove, this.movedParts[i].anchorY - this.yMove);
28 | }
29 | }
30 | }
31 |
32 | public RedoAction():void {
33 | for (var i:number = 0; i < this.movedParts.length; i++) {
34 | if (this.movedParts[i] instanceof ShapePart || this.movedParts[i] instanceof Thrusters) {
35 | this.movedParts[i].Move(this.movedParts[i].centerX + this.xMove, this.movedParts[i].centerY + this.yMove);
36 | } else if (this.movedParts[i] instanceof TextPart) {
37 | this.movedParts[i].Move(this.movedParts[i].x + this.xMove, this.movedParts[i].y + this.yMove);
38 | } else {
39 | this.movedParts[i].Move(this.movedParts[i].anchorX + this.xMove, this.movedParts[i].anchorY + this.yMove);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Actions/MoveZAction.ts:
--------------------------------------------------------------------------------
1 | import { Util } from "../imports";
2 | import { Part } from "../imports";
3 | import { TextPart } from "../imports";
4 | import { Action } from "../imports";
5 |
6 | export class MoveZAction extends Action
7 | {
8 | public static FRONT_TYPE:number = 0;
9 | public static BACK_TYPE:number = 1;
10 |
11 | private type:number;
12 | private oldIndex:number;
13 |
14 | constructor(p:Part, moveType:number, prevIndex:number = -1)
15 | {
16 | super(p);
17 | this.type = moveType;
18 | this.oldIndex = prevIndex;
19 | }
20 |
21 | public UndoAction():void {
22 | if (this.partAffected instanceof TextPart) {
23 | if (this.type == MoveZAction.FRONT_TYPE) {
24 | (this.partAffected as TextPart).inFront = false;
25 | MoveZAction.m_controller.removeChild((this.partAffected as TextPart).m_textField);
26 | MoveZAction.m_controller.addChildAt((this.partAffected as TextPart).m_textField, MoveZAction.m_controller.getChildIndex(MoveZAction.m_controller.m_canvas));
27 | } else {
28 | (this.partAffected as TextPart).inFront = true;
29 | MoveZAction.m_controller.removeChild((this.partAffected as TextPart).m_textField);
30 | MoveZAction.m_controller.addChildAt((this.partAffected as TextPart).m_textField, MoveZAction.m_controller.getChildIndex(MoveZAction.m_controller.m_canvas) + 1);
31 | }
32 | } else {
33 | MoveZAction.m_controller.allParts = Util.RemoveFromArray(this.partAffected, MoveZAction.m_controller.allParts);
34 | MoveZAction.m_controller.allParts = Util.InsertIntoArray(this.partAffected, MoveZAction.m_controller.allParts, this.oldIndex);
35 | }
36 | }
37 |
38 | public RedoAction():void {
39 | if (this.partAffected instanceof TextPart) {
40 | if (this.type == MoveZAction.FRONT_TYPE) {
41 | (this.partAffected as TextPart).inFront = true;
42 | MoveZAction.m_controller.removeChild((this.partAffected as TextPart).m_textField);
43 | MoveZAction.m_controller.addChildAt((this.partAffected as TextPart).m_textField, MoveZAction.m_controller.getChildIndex(MoveZAction.m_controller.m_canvas) + 1);
44 | } else {
45 | (this.partAffected as TextPart).inFront = false;
46 | MoveZAction.m_controller.removeChild((this.partAffected as TextPart).m_textField);
47 | MoveZAction.m_controller.addChildAt((this.partAffected as TextPart).m_textField, MoveZAction.m_controller.getChildIndex(MoveZAction.m_controller.m_canvas));
48 | }
49 | } else {
50 | if (this.type == MoveZAction.FRONT_TYPE) {
51 | MoveZAction.m_controller.allParts = Util.RemoveFromArray(this.partAffected, MoveZAction.m_controller.allParts);
52 | MoveZAction.m_controller.allParts.push(this.partAffected);
53 | } else {
54 | var foundIt:boolean = false;
55 | for (var i:number = MoveZAction.m_controller.allParts.length - 1; i > 0; i--) {
56 | if (MoveZAction.m_controller.allParts[i] == this.partAffected) foundIt = true;
57 | if (foundIt) {
58 | if (!MoveZAction.m_controller.allParts[i - 1].isEditable) {
59 | break;
60 | }
61 | MoveZAction.m_controller.allParts[i] = MoveZAction.m_controller.allParts[i - 1];
62 | }
63 | }
64 | MoveZAction.m_controller.allParts[i] = this.partAffected;
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Actions/MultiCollideAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class MultiCollideAction extends Action
4 | {
5 | private collide:boolean;
6 | private partsAffected:Array;
7 |
8 | constructor(parts:Array, collideVal:boolean)
9 | {
10 | super(parts[0]);
11 | this.partsAffected = parts;
12 | this.collide = collideVal;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.partsAffected.length; i++) {
17 | this.partsAffected[i].collide = !this.collide;
18 | }
19 | }
20 |
21 | public RedoAction():void {
22 | for (var i:number = 0; i < this.partsAffected.length; i++) {
23 | this.partsAffected[i].collide = this.collide;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/MultiColourChangeAction.ts:
--------------------------------------------------------------------------------
1 | import { TextPart } from "../imports";
2 | import { Action } from "../imports";
3 |
4 | export class MultiColourChangeAction extends Action
5 | {
6 | private partsAffected:Array;
7 | private red:number;
8 | private green:number;
9 | private blue:number;
10 | private opacity:number;
11 | private oldReds:Array;
12 | private oldGreens:Array;
13 | private oldBlues:Array;
14 | private oldOpacitys:Array;
15 |
16 | constructor(parts:Array, r:number, g:number, b:number, o:number, oldRs:Array, oldGs:Array, oldBs:Array, oldOs:Array)
17 | {
18 | super(parts[0]);
19 | this.partsAffected = parts;
20 | this.red = r;
21 | this.green = g;
22 | this.blue = b;
23 | this.opacity = o;
24 | this.oldReds = oldRs;
25 | this.oldGreens = oldGs;
26 | this.oldBlues = oldBs;
27 | this.oldOpacitys = oldOs;
28 | }
29 |
30 | public UndoAction():void {
31 | for (var i:number = 0; i < this.partsAffected.length; i++) {
32 | this.partsAffected[i].red = this.oldReds[i];
33 | this.partsAffected[i].green = this.oldGreens[i];
34 | this.partsAffected[i].blue = this.oldBlues[i];
35 | if (!(this.partsAffected[i] instanceof TextPart)) this.partsAffected[i].opacity = this.oldOpacitys[i];
36 | }
37 | }
38 |
39 | public RedoAction():void {
40 | for (var i:number = 0; i < this.partsAffected.length; i++) {
41 | this.partsAffected[i].red = this.red;
42 | this.partsAffected[i].green = this.green;
43 | this.partsAffected[i].blue = this.blue;
44 | if (!(this.partsAffected[i] instanceof TextPart)) this.partsAffected[i].opacity = this.opacity;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Actions/MultiFixateAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class MultiFixateAction extends Action
4 | {
5 | private fixate:boolean;
6 | private partsAffected:Array;
7 |
8 | constructor(parts:Array, fixateVal:boolean)
9 | {
10 | super(parts[0]);
11 | this.partsAffected = parts;
12 | this.fixate = fixateVal;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.partsAffected.length; i++) {
17 | this.partsAffected[i].isStatic = !this.fixate;
18 | }
19 | }
20 |
21 | public RedoAction():void {
22 | for (var i:number = 0; i < this.partsAffected.length; i++) {
23 | this.partsAffected[i].isStatic = this.fixate;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/MultiOutlineAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class MultiOutlineAction extends Action
4 | {
5 | private outline:boolean;
6 | private partsAffected:Array;
7 |
8 | constructor(parts:Array, outlineVal:boolean)
9 | {
10 | super(parts[0]);
11 | this.partsAffected = parts;
12 | this.outline = outlineVal;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.partsAffected.length; i++) {
17 | this.partsAffected[i].outline = !this.outline;
18 | }
19 | }
20 |
21 | public RedoAction():void {
22 | for (var i:number = 0; i < this.partsAffected.length; i++) {
23 | this.partsAffected[i].outline = this.outline;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/MultiTerrainAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class MultiTerrainAction extends Action
4 | {
5 | private terrain:boolean;
6 | private partsAffected:Array;
7 |
8 | constructor(parts:Array, terrainVal:boolean)
9 | {
10 | super(parts[0]);
11 | this.partsAffected = parts;
12 | this.terrain = terrainVal;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.partsAffected.length; i++) {
17 | this.partsAffected[i].terrain = !this.terrain;
18 | }
19 | }
20 |
21 | public RedoAction():void {
22 | for (var i:number = 0; i < this.partsAffected.length; i++) {
23 | this.partsAffected[i].terrain = this.terrain;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/MultiUndragableAction.ts:
--------------------------------------------------------------------------------
1 | import { Action } from "../imports";
2 |
3 | export class MultiUndragableAction extends Action
4 | {
5 | private undragable:boolean;
6 | private partsAffected:Array;
7 |
8 | constructor(parts:Array, undragableVal:boolean)
9 | {
10 | super(parts[0]);
11 | this.partsAffected = parts;
12 | this.undragable = undragableVal;
13 | }
14 |
15 | public UndoAction():void {
16 | for (var i:number = 0; i < this.partsAffected.length; i++) {
17 | this.partsAffected[i].undragable = !this.undragable;
18 | }
19 | }
20 |
21 | public RedoAction():void {
22 | for (var i:number = 0; i < this.partsAffected.length; i++) {
23 | this.partsAffected[i].undragable = this.undragable;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Actions/ResizeTextAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { TextPart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class ResizeTextAction extends Action
6 | {
7 | private changeX:number;
8 | private changeY:number;
9 | private changeW:number;
10 | private changeH:number;
11 |
12 | constructor(p:Part, deltaX:number, deltaY:number, deltaW:number, deltaH:number)
13 | {
14 | super(p);
15 | this.changeX = deltaX;
16 | this.changeY = deltaY;
17 | this.changeW = deltaW;
18 | this.changeH = deltaH;
19 | }
20 |
21 | public UndoAction():void {
22 | (this.partAffected as TextPart).x -= this.changeX;
23 | (this.partAffected as TextPart).y -= this.changeY;
24 | (this.partAffected as TextPart).w -= this.changeW;
25 | (this.partAffected as TextPart).h -= this.changeH;
26 | }
27 |
28 | public RedoAction():void {
29 | (this.partAffected as TextPart).x += this.changeX;
30 | (this.partAffected as TextPart).y += this.changeY;
31 | (this.partAffected as TextPart).w += this.changeW;
32 | (this.partAffected as TextPart).h += this.changeH;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Actions/RotateAction.ts:
--------------------------------------------------------------------------------
1 | import { Util } from "../imports";
2 | import { Part } from "../imports";
3 | import { PrismaticJoint } from "../imports";
4 | import { ShapePart } from "../imports";
5 | import { Thrusters } from "../imports";
6 | import { Action } from "../imports";
7 |
8 | export class RotateAction extends Action
9 | {
10 | private angle:number;
11 | private rotatedParts:Array;
12 |
13 | constructor(p:Part, attachedParts:Array, deltaAngle:number) {
14 | super(p);
15 | this.angle = deltaAngle;
16 | this.rotatedParts = attachedParts;
17 | }
18 |
19 | public UndoAction():void {
20 | for (var i:number = 0; i < this.rotatedParts.length; i++) {
21 | if (this.rotatedParts[i] instanceof ShapePart || this.rotatedParts[i] instanceof Thrusters) {
22 | this.rotatedParts[i].rotateAngle = Math.atan2(this.rotatedParts[i].centerY - (this.partAffected as Object).centerY, this.rotatedParts[i].centerX - (this.partAffected as Object).centerX);
23 | this.rotatedParts[i].rotateOrientation = this.rotatedParts[i].angle;
24 | } else {
25 | this.rotatedParts[i].rotateAngle = Math.atan2(this.rotatedParts[i].anchorY - (this.partAffected as Object).centerY, this.rotatedParts[i].anchorX - (this.partAffected as Object).centerX);
26 | if (this.rotatedParts[i] instanceof PrismaticJoint) {
27 | this.rotatedParts[i].rotateOrientation = Util.GetAngle(this.rotatedParts[i].axis);
28 | }
29 | }
30 | this.rotatedParts[i].RotateAround((this.partAffected as Object).centerX, (this.partAffected as Object).centerY, -this.angle);
31 | }
32 | }
33 |
34 | public RedoAction():void {
35 | for (var i:number = 0; i < this.rotatedParts.length; i++) {
36 | if (this.rotatedParts[i] instanceof ShapePart || this.rotatedParts[i] instanceof Thrusters) {
37 | this.rotatedParts[i].rotateAngle = Math.atan2(this.rotatedParts[i].centerY - (this.partAffected as Object).centerY, this.rotatedParts[i].centerX - (this.partAffected as Object).centerX);
38 | this.rotatedParts[i].rotateOrientation = this.rotatedParts[i].angle;
39 | } else {
40 | this.rotatedParts[i].rotateAngle = Math.atan2(this.rotatedParts[i].anchorY - (this.partAffected as Object).centerY, this.rotatedParts[i].anchorX - (this.partAffected as Object).centerX);
41 | if (this.rotatedParts[i] instanceof PrismaticJoint) {
42 | this.rotatedParts[i].rotateOrientation = Util.GetAngle(this.rotatedParts[i].axis);
43 | }
44 | }
45 | this.rotatedParts[i].RotateAround((this.partAffected as Object).centerX, (this.partAffected as Object).centerY, this.angle);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Actions/ShapeCheckboxAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { PrismaticJoint } from "../imports";
3 | import { ShapePart } from "../imports";
4 | import { Action } from "../imports";
5 |
6 | export class ShapeCheckboxAction extends Action
7 | {
8 | public static COLLIDE_TYPE:number = 0;
9 | public static FIXATE_TYPE:number = 1;
10 | public static OUTLINE_TYPE:number = 2;
11 | public static TERRAIN_TYPE:number = 3;
12 | public static UNDRAGABLE_TYPE:number = 4;
13 |
14 | private type:number;
15 | private isChecked:boolean;
16 |
17 | constructor(p:Part, checkboxType:number, checked:boolean)
18 | {
19 | super(p);
20 | this.type = checkboxType;
21 | this.isChecked = checked;
22 | }
23 |
24 | public UndoAction():void {
25 | if (this.type == ShapeCheckboxAction.COLLIDE_TYPE) {
26 | if (this.partAffected instanceof ShapePart) (this.partAffected as ShapePart).collide = !this.isChecked;
27 | else (this.partAffected as PrismaticJoint).collide = !this.isChecked;
28 | } else if (this.type == ShapeCheckboxAction.FIXATE_TYPE) {
29 | (this.partAffected as ShapePart).isStatic = !this.isChecked;
30 | } else if (this.type == ShapeCheckboxAction.OUTLINE_TYPE) {
31 | if (this.partAffected instanceof ShapePart) (this.partAffected as ShapePart).outline = !this.isChecked;
32 | else (this.partAffected as PrismaticJoint).outline = !this.isChecked;
33 | } else if (this.type == ShapeCheckboxAction.TERRAIN_TYPE) {
34 | (this.partAffected as ShapePart).terrain = !this.isChecked;
35 | } else {
36 | (this.partAffected as ShapePart).undragable = !this.isChecked;
37 | }
38 | }
39 |
40 | public RedoAction():void {
41 | if (this.type == ShapeCheckboxAction.COLLIDE_TYPE) {
42 | if (this.partAffected instanceof ShapePart) (this.partAffected as ShapePart).collide = this.isChecked;
43 | else (this.partAffected as PrismaticJoint).collide = this.isChecked;
44 | } else if (this.type == ShapeCheckboxAction.FIXATE_TYPE) {
45 | (this.partAffected as ShapePart).isStatic = this.isChecked;
46 | } else if (this.type == ShapeCheckboxAction.OUTLINE_TYPE) {
47 | if (this.partAffected instanceof ShapePart) (this.partAffected as ShapePart).outline = this.isChecked;
48 | else (this.partAffected as PrismaticJoint).outline = this.isChecked;
49 | } else if (this.type == ShapeCheckboxAction.TERRAIN_TYPE) {
50 | (this.partAffected as ShapePart).terrain = this.isChecked;
51 | } else {
52 | (this.partAffected as ShapePart).undragable = !this.isChecked;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Actions/TextCheckboxAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { TextPart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class TextCheckboxAction extends Action
6 | {
7 | public static SCALE_TYPE:number = 0;
8 | public static DISPLAY_TYPE:number = 1;
9 |
10 | private type:number;
11 | private isChecked:boolean;
12 |
13 | constructor(p:Part, checkboxType:number, checked:boolean)
14 | {
15 | super(p);
16 | this.type = checkboxType;
17 | this.isChecked = checked;
18 | }
19 |
20 | public UndoAction():void {
21 | if (this.type == TextCheckboxAction.SCALE_TYPE) {
22 | (this.partAffected as TextPart).scaleWithZoom = !this.isChecked;
23 | } else {
24 | (this.partAffected as TextPart).alwaysVisible = !this.isChecked;
25 | }
26 | }
27 |
28 | public RedoAction():void {
29 | if (this.type == TextCheckboxAction.SCALE_TYPE) {
30 | (this.partAffected as TextPart).scaleWithZoom = this.isChecked;
31 | } else {
32 | (this.partAffected as TextPart).alwaysVisible = this.isChecked;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Actions/TextSizeChangeAction.ts:
--------------------------------------------------------------------------------
1 | import { Part } from "../imports";
2 | import { TextPart } from "../imports";
3 | import { Action } from "../imports";
4 |
5 | export class TextSizeChangeAction extends Action
6 | {
7 | private type:number;
8 | private change:number;
9 |
10 | constructor(p:Part, delta:number)
11 | {
12 | super(p);
13 | this.change = delta;
14 | }
15 |
16 | public UndoAction():void {
17 | (this.partAffected as TextPart).size -= this.change;
18 | }
19 |
20 | public RedoAction():void {
21 | (this.partAffected as TextPart).size += this.change;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/ClipVertex.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactID, b2Vec2 } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | export class ClipVertex
29 | {
30 | public v:b2Vec2 = new b2Vec2();
31 | public id:b2ContactID = new b2ContactID();
32 | }
33 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Features.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactID } from "..";
20 |
21 |
22 |
23 | // We use contact ids to facilitate warm starting.
24 | export class Features
25 | {
26 | ///< The edge that defines the outward contact normal.
27 | public set referenceEdge(value:number) {
28 | this._referenceEdge = value;
29 | this._m_id._key = (this._m_id._key & 0xffffff00) | (this._referenceEdge & 0x000000ff);
30 | }
31 | public get referenceEdge():number{
32 | return this._referenceEdge;
33 | }
34 | public _referenceEdge:number;
35 |
36 | ///< The edge most anti-parallel to the reference edge.
37 | public set incidentEdge(value:number) {
38 | this._incidentEdge = value;
39 | this._m_id._key = (this._m_id._key & 0xffff00ff) | ((this._incidentEdge << 8) & 0x0000ff00);
40 | }
41 | public get incidentEdge():number{
42 | return this._incidentEdge;
43 | }
44 | public _incidentEdge:number;
45 |
46 | ///< The vertex (0 or 1) on the incident edge that was clipped.
47 | public set incidentVertex(value:number) {
48 | this._incidentVertex = value;
49 | this._m_id._key = (this._m_id._key & 0xff00ffff) | ((this._incidentVertex << 16) & 0x00ff0000);
50 | }
51 | public get incidentVertex():number{
52 | return this._incidentVertex;
53 | }
54 | public _incidentVertex:number;
55 |
56 | ///< A value of 1 indicates that the reference edge is on shape2.
57 | public set flip(value:number) {
58 | this._flip = value;
59 | this._m_id._key = (this._m_id._key & 0x00ffffff) | ((this._flip << 24) & 0xff000000);
60 | }
61 | public get flip():number{
62 | return this._flip;
63 | }
64 | public _flip:number;
65 |
66 |
67 | public _m_id:b2ContactID;
68 | }
69 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2CircleDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Shape, b2ShapeDef, b2Vec2 } from "../..";
20 |
21 | /// This structure is used to build circle shapes.
22 | export class b2CircleDef extends b2ShapeDef
23 | {
24 | public constructor()
25 | {
26 | super()
27 | this.type = b2Shape.e_circleShape;
28 | this.radius = 1.0;
29 | }
30 |
31 | public localPosition:b2Vec2 = new b2Vec2(0.0, 0.0);
32 | public radius:number;
33 | }
34 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2ConcaveArcDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2PolygonDef, b2Shape } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | /// This structure is used to build b2ConcaveArcDef.
31 | export class b2ConcaveArcDef extends b2PolygonDef
32 | {
33 | constructor()
34 | {
35 | super();
36 | this.type = b2Shape.e_concaveArcShape;
37 | this.radius = 1.0;
38 | }
39 |
40 | ///The radius of the arc
41 | public radius:number;
42 | }
43 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2ConvexArcDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Shape, b2ShapeDef, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | /// This structure is used to build b2ConvexArcShape.
30 | export class b2ConvexArcDef extends b2ShapeDef
31 | {
32 | constructor()
33 | {
34 | super()
35 | this.type = b2Shape.e_convexArcShape;
36 | this.norm = new b2Vec2(0, 1.0);
37 | this.radius = 50;
38 | this.offset = 0;
39 | }
40 |
41 | public radius:number;
42 | public norm:b2Vec2;
43 | public offset:number;
44 | }
45 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2FilterData.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | /// This holds contact filtering data.
27 | export class b2FilterData
28 | {
29 | public Copy() : b2FilterData {
30 | var copy: b2FilterData = new b2FilterData();
31 | copy.categoryBits = this.categoryBits;
32 | copy.maskBits = this.maskBits;
33 | copy.groupIndex = this.groupIndex;
34 | return copy;
35 | }
36 |
37 | /// The collision category bits. Normally you would just set one bit.
38 | public categoryBits: number = 0x0001;
39 |
40 | /// The collision mask bits. This states the categories that this
41 | /// shape would accept for collision.
42 | public maskBits: number = 0xFFFF;
43 |
44 | /// Collision groups allow a certain group of objects to never collide (negative)
45 | /// or always collide (positive). Zero means no collision group. Non-zero group
46 | /// filtering always wins against the mask bits.
47 | public groupIndex: number = 0;
48 | }
49 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2MassData.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Math, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | /// This holds the mass data computed for a shape.
29 | export class b2MassData
30 | {
31 | /// The mass of the shape, usually in kilograms.
32 | public mass:number = 0.0;
33 | /// The position of the shape's centroid relative to the shape's origin.
34 | public center:b2Vec2 = new b2Vec2(0,0);
35 | /// The rotational inertia of the shape.
36 | public I:number = 0.0;
37 |
38 | public static Add(...masses):b2MassData
39 | {
40 | var finalMass:b2MassData=new b2MassData();
41 | for(var massData of masses) {
42 | finalMass.mass += massData.mass;
43 | }
44 | //b2Settings.b2Assert(finalMass.mass>=0);
45 | if(Math.abs(finalMass.mass)>Number.MIN_VALUE){
46 | for(massData of masses){
47 | finalMass.center.x += massData.mass*massData.center.x;
48 | finalMass.center.y += massData.mass*massData.center.y;
49 | }
50 | finalMass.center.x /= finalMass.mass;
51 | finalMass.center.y /= finalMass.mass;
52 | for(massData of masses){
53 | finalMass.I += massData.I;
54 | var r:b2Vec2 = b2Math.SubtractVV(massData.center, finalMass.center);
55 | finalMass.I += massData.mass * b2Math.b2Dot(r, r);
56 | }
57 | }
58 | return finalMass;
59 | }
60 |
61 | public Set(massData:b2MassData):void
62 | {
63 | this.mass = massData.mass;
64 | this.center.x = massData.center.x;
65 | this.center.y = massData.center.y;
66 | this.I = massData.I;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2ShapeDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2FilterData, b2Shape } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | /// A shape definition is used to construct a shape. This class defines an
32 | /// abstract shape definition. You can reuse shape definitions safely.
33 | export class b2ShapeDef
34 | {
35 | /// Holds the shape type for down-casting.
36 | public type:number = b2Shape.e_unknownShape;
37 |
38 | /// Use this to store application specify shape data.
39 | public userData:any = null;
40 |
41 | /// The shape's friction coefficient, usually in the range [0,1].
42 | public friction:number = 0.2;
43 |
44 | /// The shape's restitution (elasticity) usually in the range [0,1].
45 | public restitution:number = 0.0;
46 |
47 | /// The shape's density, usually in kg/m^2.
48 | public density:number = 0.0;
49 |
50 | /// A sensor shape collects contact information but never generates a collision
51 | /// response.
52 | public isSensor:boolean = false;
53 |
54 | /// Contact filtering data.
55 | public filter: b2FilterData = new b2FilterData();
56 | }
57 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/Shapes/b2StaticEdgeChainDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Shape, b2ShapeDef } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | export class b2StaticEdgeChainDef extends b2ShapeDef
31 | {
32 | constructor()
33 | {
34 | super()
35 | this.type = b2Shape.e_staticEdgeShape;
36 | this.isALoop = true;
37 | this.vertexCount = 0;
38 | }
39 |
40 | /// The vertices in local coordinates.
41 | public vertices:Array = new Array();
42 |
43 | /// The number of vertices in the chain.
44 | public vertexCount:number;
45 |
46 | /// Whether to create an extra edge between the first and last vertex:
47 | public isALoop:boolean;
48 | }
49 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2AABB.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Vec2 } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 | // A manifold for two touching convex shapes.
27 | export class b2AABB
28 | {
29 | /// Verify that the bounds are sorted.
30 | public IsValid():boolean{
31 | //b2Vec2 d = upperBound - lowerBound;;
32 | var dX:number = this.upperBound.x - this.lowerBound.x;
33 | var dY:number = this.upperBound.y - this.lowerBound.y;
34 | var valid:boolean = dX >= 0.0 && dY >= 0.0;
35 | valid = valid && this.lowerBound.IsValid() && this.upperBound.IsValid();
36 | return valid;
37 | }
38 |
39 | public lowerBound:b2Vec2 = new b2Vec2(); ///< the lower vertex
40 | public upperBound:b2Vec2 = new b2Vec2(); ///< the upper vertex
41 | }
42 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2Bound.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2Bound{
23 | public IsLower():boolean { return (this.value & 1) == 0; }
24 | public IsUpper():boolean { return (this.value & 1) == 1; }
25 | public Swap(b:b2Bound) : void{
26 | var tempValue:number = this.value;
27 | var tempProxyId:number = this.proxyId;
28 | var tempStabbingCount:number = this.stabbingCount;
29 |
30 | this.value = b.value;
31 | this.proxyId = b.proxyId;
32 | this.stabbingCount = b.stabbingCount;
33 |
34 | b.value = tempValue;
35 | b.proxyId = tempProxyId;
36 | b.stabbingCount = tempStabbingCount;
37 | }
38 |
39 | public value:number;
40 | public proxyId:number;
41 | public stabbingCount:number;
42 | }
43 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2BoundValues.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2BoundValues{
23 | public lowerValues:Array = [0,0];
24 | public upperValues:Array = [0,0];
25 | }
26 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2BufferedPair.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2BufferedPair{
23 | public proxyId1:number;
24 | public proxyId2:number;
25 | }
26 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2ContactID.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { Features } from "./Features";
20 |
21 |
22 |
23 |
24 |
25 | // We use contact ids to facilitate warm starting.
26 | export class b2ContactID
27 | {
28 | constructor(){
29 | this.features._m_id = this;
30 |
31 | }
32 | public Set(id:b2ContactID) : void{
33 | this.key = id._key;
34 | }
35 | public Copy():b2ContactID{
36 | var id:b2ContactID = new b2ContactID();
37 | id.key = this.key;
38 | return id;
39 | }
40 | public get key():number {
41 | return this._key;
42 | }
43 | public set key(value:number) {
44 | this._key = value;
45 | this.features._referenceEdge = this._key & 0x000000ff;
46 | this.features._incidentEdge = ((this._key & 0x0000ff00) >> 8) & 0x000000ff;
47 | this.features._incidentVertex = ((this._key & 0x00ff0000) >> 16) & 0x000000ff;
48 | this.features._flip = ((this._key & 0xff000000) >> 24) & 0x000000ff;
49 | }
50 | public features:Features = new Features();
51 | public _key:number;///< Used to quickly compare contact ids.
52 | }
53 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2ContactPoint.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactID, b2Shape, b2Vec2 } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | /// This structure is used to report contact points.
28 | export class b2ContactPoint
29 | {
30 | public shape1:b2Shape; ///< the first shape
31 | public shape2:b2Shape; ///< the second shape
32 | public position:b2Vec2 = new b2Vec2(); ///< position in world coordinates
33 | public velocity:b2Vec2 = new b2Vec2(); ///< velocity of point on body2 relative to point on body1 (pre-solver)
34 | public normal:b2Vec2 = new b2Vec2(); ///< points from shape1 to shape2
35 | public separation:number; ///< the separation is negative when shapes are touching
36 | public friction:number; ///< the combined friction coefficient
37 | public restitution:number; ///< the combined restitution coefficient
38 | public id:b2ContactID = new b2ContactID(); ///< the contact id identifies the features in contact
39 | }
40 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2DistanceRegister.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 | export class b2DistanceRegister
22 | {
23 | constructor(fcn: Function, primary: boolean) {
24 | this.fcn = fcn;
25 | this.primary = primary;
26 | }
27 | public fcn: Function;
28 | public primary: boolean;
29 | }
30 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2Manifold.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ManifoldPoint, b2Settings, b2Vec2 } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 | // A manifold for two touching convex shapes.
27 | export class b2Manifold
28 | {
29 | constructor(){
30 | var maxPoints:number = b2Settings.b2_maxManifoldPoints;
31 | this.points = new Array(maxPoints);
32 | for (var i:number = 0; i < maxPoints; i++){
33 | this.points[i] = new b2ManifoldPoint();
34 | }
35 | this.normal = new b2Vec2();
36 | }
37 | public Reset() : void{
38 | var maxPoints:number = b2Settings.b2_maxManifoldPoints;
39 | for (var i:number = 0; i < maxPoints; i++){
40 | (this.points[i] as b2ManifoldPoint).Reset();
41 | }
42 | this.normal.SetZero();
43 | this.pointCount = 0;
44 | }
45 | public Set(m:b2Manifold) : void{
46 | this.pointCount = m.pointCount;
47 | var maxPoints:number = b2Settings.b2_maxManifoldPoints;
48 | for (var i:number = 0; i < maxPoints; i++){
49 | (this.points[i] as b2ManifoldPoint).Set(m.points[i]);
50 | }
51 | this.normal.SetV(m.normal);
52 | }
53 | public points:Array; ///< the points of contact
54 | public normal:b2Vec2; ///< the shared unit normal vector
55 | public pointCount:number = 0; ///< the number of manifold points
56 | }
57 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2ManifoldPoint.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactID, b2Vec2 } from "..";
20 |
21 | /// A manifold point is a contact point belonging to a contact
22 | /// manifold. It holds details related to the geometry and dynamics
23 | /// of the contact points.
24 | /// The point is stored in local coordinates because CCD
25 | /// requires sub-stepping in which the separation is stale.
26 | export class b2ManifoldPoint
27 | {
28 | public Reset() : void{
29 | this.localPoint1.SetZero();
30 | this.localPoint2.SetZero();
31 | this.separation = 0.0;
32 | this.normalImpulse = 0.0;
33 | this.tangentImpulse = 0.0;
34 | this.id.key = 0;
35 | }
36 | public Set(m:b2ManifoldPoint) : void{
37 | this.localPoint1.SetV(m.localPoint1);
38 | this.localPoint2.SetV(m.localPoint2);
39 | this.separation = m.separation;
40 | this.normalImpulse = m.normalImpulse;
41 | this.tangentImpulse = m.tangentImpulse;
42 | this.id.key = m.id.key;
43 | }
44 | public localPoint1:b2Vec2 = new b2Vec2();
45 | public localPoint2:b2Vec2 = new b2Vec2();
46 | public separation:number;
47 | public normalImpulse:number;
48 | public tangentImpulse:number;
49 | public id:b2ContactID = new b2ContactID();
50 | }
51 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2OBB.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Mat22, b2Vec2 } from "..";
20 |
21 |
22 |
23 |
24 |
25 | /// An oriented bounding box.
26 | export class b2OBB
27 | {
28 | public R:b2Mat22 = new b2Mat22(); ///< the rotation matrix
29 | public center:b2Vec2 = new b2Vec2(); ///< the local centroid
30 | public extents:b2Vec2 = new b2Vec2(); ///< the half-widths
31 | }
32 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2Pair.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Settings } from "..";
20 |
21 | // The pair manager is used by the broad-phase to quickly add/remove/find pairs
22 | // of overlapping proxies. It is based closely on code provided by Pierre Terdiman.
23 | // http://www.codercorner.com/IncrementalSAP.txt
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | export class b2Pair
32 | {
33 |
34 |
35 | public SetBuffered() : void { this.status |= b2Pair.e_pairBuffered; }
36 | public ClearBuffered() : void { this.status &= ~b2Pair.e_pairBuffered; }
37 | public IsBuffered():boolean { return (this.status & b2Pair.e_pairBuffered) == b2Pair.e_pairBuffered; }
38 |
39 | public SetRemoved() : void { this.status |= b2Pair.e_pairRemoved; }
40 | public ClearRemoved() : void { this.status &= ~b2Pair.e_pairRemoved; }
41 | public IsRemoved():boolean { return (this.status & b2Pair.e_pairRemoved) == b2Pair.e_pairRemoved; }
42 |
43 | public SetFinal() : void { this.status |= b2Pair.e_pairFinal; }
44 | public IsFinal():boolean { return (this.status & b2Pair.e_pairFinal) == b2Pair.e_pairFinal; }
45 |
46 | public userData:any = null;
47 | public proxyId1:number;
48 | public proxyId2:number;
49 | public next:number;
50 | public status:number;
51 |
52 | // STATIC
53 | public static b2_nullPair:number = b2Settings.USHRT_MAX;
54 | public static b2_nullProxy:number = b2Settings.USHRT_MAX;
55 | public static b2_tableCapacity:number = b2Settings.b2_maxPairs; // must be a power of two
56 | public static b2_tableMask:number = b2Pair.b2_tableCapacity - 1;
57 |
58 | // enum
59 | public static e_pairBuffered:number = 0x0001;
60 | public static e_pairRemoved:number = 0x0002;
61 | public static e_pairFinal:number = 0x0004;
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2PairCallback.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2PairCallback
23 | {
24 | //virtual ~b2PairCallback() {}
25 |
26 | // This returns the new pair user data.
27 | public PairAdded(proxyUserData1:any, proxyUserData2:any):any{return null};
28 |
29 | // This should free the pair's user data. In extreme circumstances, it is possible
30 | // this will be called with null pairUserData because the pair never existed.
31 | public PairRemoved(proxyUserData1:any, proxyUserData2:any, pairUserData:any) : void{};
32 | }
33 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2Point.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Vec2, b2XForm } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 | // This is used for polygon-vs-circle distance.
27 | export class b2Point
28 | {
29 | public Support(xf:b2XForm, vX:number, vY:number) : b2Vec2
30 | {
31 | return this.p;
32 | }
33 |
34 | public GetFirstVertex(xf:b2XForm) : b2Vec2
35 | {
36 | return this.p;
37 | }
38 |
39 | public p:b2Vec2 = new b2Vec2();
40 | }
41 |
--------------------------------------------------------------------------------
/src/Box2D/Collision/b2Proxy.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { uint } from "..";
20 | import { b2BroadPhase } from "./b2BroadPhase";
21 |
22 |
23 |
24 |
25 | export class b2Proxy{
26 | public GetNext():number { return this.lowerBounds[0]; }
27 | public SetNext(next:number) : void { this.lowerBounds[0] = next & 0x0000ffff; }
28 |
29 | public IsValid():boolean { return this.overlapCount != b2BroadPhase.b2_invalid; }
30 |
31 | public lowerBounds:Array = [uint(0), uint(0)];
32 | public upperBounds:Array = [uint(0), uint(0)];
33 | public overlapCount:number;
34 | public timeStamp:number;
35 |
36 | public userData:any = null;
37 | }
38 |
--------------------------------------------------------------------------------
/src/Box2D/Common/Math/b2XForm.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Mat22, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | /// A transform contains translation and rotation. It is used to represent
28 | /// the position and orientation of rigid frames.
29 | export class b2XForm
30 | {
31 | /// The default constructor does nothing (for performance).
32 | constructor(pos:b2Vec2=null, r:b2Mat22=null)
33 | {
34 | if (pos){
35 | this.position.SetV(pos);
36 | this.R.SetM(r);
37 |
38 | }
39 | }
40 |
41 | /// Initialize using a position vector and a rotation matrix.
42 | public Initialize(pos:b2Vec2, r:b2Mat22) : void
43 | {
44 | this.position.SetV(pos);
45 | this.R.SetM(r);
46 | }
47 |
48 | /// Set this to the identity transform.
49 | public SetIdentity() : void
50 | {
51 | this.position.SetZero();
52 | this.R.SetIdentity();
53 | }
54 |
55 |
56 |
57 | public Set(x:b2XForm) : void{
58 |
59 | this.position.SetV(x.position);
60 |
61 | this.R.SetM(x.R);
62 |
63 | }
64 |
65 | public position:b2Vec2 = new b2Vec2;
66 | public R:b2Mat22 = new b2Mat22();
67 | }
68 |
--------------------------------------------------------------------------------
/src/Box2D/Common/b2Color.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Math, uint } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 | /// A 2D column vector.
27 |
28 | export class b2Color
29 | {
30 |
31 | constructor(rr:number, gg:number, bb:number){
32 | this._r = uint(255 * b2Math.b2Clamp(rr, 0.0, 1.0));
33 | this._g = uint(255 * b2Math.b2Clamp(gg, 0.0, 1.0));
34 | this._b = uint(255 * b2Math.b2Clamp(bb, 0.0, 1.0));
35 | }
36 |
37 | public Set(rr:number, gg:number, bb:number):void{
38 | this._r = uint(255 * b2Math.b2Clamp(rr, 0.0, 1.0));
39 | this._g = uint(255 * b2Math.b2Clamp(gg, 0.0, 1.0));
40 | this._b = uint(255 * b2Math.b2Clamp(bb, 0.0, 1.0));
41 | }
42 |
43 | // R
44 | public set r(rr:number) {
45 | this._r = uint(255 * b2Math.b2Clamp(rr, 0.0, 1.0));
46 | }
47 | // G
48 | public set g(gg:number) {
49 | this._g = uint(255 * b2Math.b2Clamp(gg, 0.0, 1.0));
50 | }
51 | // B
52 | public set b(bb:number) {
53 | this._b = uint(255 * b2Math.b2Clamp(bb, 0.0, 1.0));
54 | }
55 |
56 | // Color
57 | public get color() : number {
58 | return (this._r) | (this._g << 8) | (this._b << 16);
59 | }
60 |
61 | private _r:number = 0;
62 | private _g:number = 0;
63 | private _b:number = 0;
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2ContactConstraint.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2ContactConstraintPoint, b2Manifold, b2Settings, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | export class b2ContactConstraint
31 | {
32 | constructor(){
33 | this.points = new Array(b2Settings.b2_maxManifoldPoints);
34 | for (var i:number = 0; i < b2Settings.b2_maxManifoldPoints; i++){
35 | this.points[i] = new b2ContactConstraintPoint();
36 | }
37 | }
38 | public points:Array;
39 | public normal:b2Vec2=new b2Vec2();
40 | public manifold:b2Manifold;
41 | public body1:b2Body;
42 | public body2:b2Body;
43 | public friction:number;
44 | public restitution:number;
45 | public pointCount:number;
46 | }
47 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2ContactConstraintPoint.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | export class b2ContactConstraintPoint
28 | {
29 | public localAnchor1:b2Vec2=new b2Vec2();
30 | public localAnchor2:b2Vec2=new b2Vec2();
31 | public r1:b2Vec2=new b2Vec2();
32 | public r2:b2Vec2=new b2Vec2();
33 | public normalImpulse:number;
34 | public tangentImpulse:number;
35 | public positionImpulse:number;
36 | public normalMass:number;
37 | public tangentMass:number;
38 | public equalizedMass:number;
39 | public separation:number;
40 | public velocityBias:number;
41 | }
42 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2ContactEdge.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2Contact } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | /// A contact edge is used to connect bodies and contacts together
28 | /// in a contact graph where each body is a node and each contact
29 | /// is an edge. A contact edge belongs to a doubly linked list
30 | /// maintained in each attached body. Each contact has two contact
31 | /// nodes, one for each attached body.
32 | export class b2ContactEdge
33 | {
34 | public other:b2Body;
35 | public contact:b2Contact;
36 | public prev:b2ContactEdge;
37 | public next:b2ContactEdge;
38 | };
39 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2ContactRegister.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2ContactRegister
23 | {
24 | public createFcn:Function; // fcn pointer
25 | public destroyFcn:Function;// fcn pointer
26 | public primary:boolean;
27 | }
28 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2ContactResult.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactID, b2Shape, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | /// This structure is used to report contact point results.
28 | export class b2ContactResult
29 | {
30 | public shape1:b2Shape; ///< the first shape
31 | public shape2:b2Shape; ///< the second shape
32 | public position:b2Vec2 = new b2Vec2(); ///< position in world coordinates
33 | public normal:b2Vec2 = new b2Vec2(); ///< points from shape1 to shape2
34 | public normalImpulse:number; ///< the normal impulse applied to body2
35 | public tangentImpulse:number; ///< the tangent impulse applied to body2
36 | public id:b2ContactID = new b2ContactID(); ///< the contact id identifies the features in contact
37 | }
38 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Contacts/b2NullContact.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Contact, b2ContactListener } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | export class b2NullContact extends b2Contact
29 | {
30 | constructor() { super() }
31 | public Evaluate(l:b2ContactListener): void {}
32 | public GetManifolds():Array { return null; }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2DistanceJointDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2Joint, b2JointDef, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | /// Distance joint definition. This requires defining an
30 | /// anchor point on both bodies and the non-zero length of the
31 | /// distance joint. The definition uses local anchor points
32 | /// so that the initial configuration can violate the constraint
33 | /// slightly. This helps when saving and loading a game.
34 | /// @warning Do not use a zero or short length.
35 | export class b2DistanceJointDef extends b2JointDef
36 | {
37 | public b2DistanceJointDef()
38 | {
39 | this.type = b2Joint.e_distanceJoint;
40 | //localAnchor1.Set(0.0, 0.0);
41 | //localAnchor2.Set(0.0, 0.0);
42 | length = 1.0;
43 | this.frequencyHz = 0.0;
44 | this.dampingRatio = 0.0;
45 | }
46 |
47 | /// Initialize the bodies, anchors, and length using the world
48 | /// anchors.
49 | public Initialize(b1:b2Body, b2:b2Body,
50 | anchor1:b2Vec2, anchor2:b2Vec2) : void
51 | {
52 | this.body1 = b1;
53 | this.body2 = b2;
54 | this.localAnchor1.SetV( this.body1.GetLocalPoint(anchor1));
55 | this.localAnchor2.SetV( this.body2.GetLocalPoint(anchor2));
56 | var dX:number = anchor2.x - anchor1.x;
57 | var dY:number = anchor2.y - anchor1.y;
58 | length = Math.sqrt(dX*dX + dY*dY);
59 | this.frequencyHz = 0.0;
60 | this.dampingRatio = 0.0;
61 | }
62 |
63 | /// The local anchor point relative to body1's origin.
64 | public localAnchor1:b2Vec2 = new b2Vec2();
65 |
66 | /// The local anchor point relative to body2's origin.
67 | public localAnchor2:b2Vec2 = new b2Vec2();
68 |
69 | /// The equilibrium length between the anchor points.
70 | public length:number;
71 |
72 | /// The response speed.
73 | public frequencyHz:number;
74 |
75 | /// The damping ratio. 0 = no damping, 1 = critical damping.
76 | public dampingRatio:number;
77 | }
78 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2GearJointDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Joint, b2JointDef } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | /// Gear joint definition. This definition requires two existing
29 | /// revolute or prismatic joints (any combination will work).
30 | /// The provided joints must attach a dynamic body to a static body.
31 |
32 | export class b2GearJointDef extends b2JointDef
33 | {
34 | constructor()
35 | {
36 | super();
37 | this.type = b2Joint.e_gearJoint;
38 | this.joint1 = null;
39 | this.joint2 = null;
40 | this.ratio = 1.0;
41 | }
42 |
43 | /// The first revolute/prismatic joint attached to the gear joint.
44 | public joint1:b2Joint;
45 | /// The second revolute/prismatic joint attached to the gear joint.
46 | public joint2:b2Joint;
47 | /// The gear ratio.
48 | /// @see b2GearJoint for explanation.
49 | public ratio:number;
50 | }
51 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2Jacobian.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | export class b2Jacobian
28 | {
29 | public linear1:b2Vec2 = new b2Vec2();
30 | public angular1:number;
31 | public linear2:b2Vec2 = new b2Vec2();
32 | public angular2:number;
33 |
34 | public SetZero() : void{
35 | this.linear1.SetZero(); this.angular1 = 0.0;
36 | this.linear2.SetZero(); this.angular2 = 0.0;
37 | }
38 | public Set(x1:b2Vec2, a1:number, x2:b2Vec2, a2:number) : void{
39 | this.linear1.SetV(x1); this.angular1 = a1;
40 | this.linear2.SetV(x2); this.angular2 = a2;
41 | }
42 | public Compute(x1:b2Vec2, a1:number, x2:b2Vec2, a2:number):number{
43 |
44 | //return b2Math.b2Dot(linear1, x1) + angular1 * a1 + b2Math.b2Dot(linear2, x2) + angular2 * a2;
45 | return (this.linear1.x*x1.x + this.linear1.y*x1.y) + this.angular1 * a1 + (this.linear2.x*x2.x + this.linear2.y*x2.y) + this.angular2 * a2;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2JointDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2Joint } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | /// Joint definitions are used to construct joints.
29 | export class b2JointDef
30 | {
31 |
32 | constructor()
33 | {
34 | this.type = b2Joint.e_unknownJoint;
35 | this.userData = null;
36 | this.body1 = null;
37 | this.body2 = null;
38 | this.collideConnected = false;
39 | }
40 |
41 | /// The joint type is set automatically for concrete joint types.
42 | public type:number;
43 | /// Use this to attach application specific data to your joints.
44 | public userData:any;
45 | /// The first attached body.
46 | public body1:b2Body;
47 | /// The second attached body.
48 | public body2:b2Body;
49 | /// Set this flag to true if the attached bodies should collide.
50 | public collideConnected:boolean;
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2JointEdge.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2Joint } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 | /// A joint edge is used to connect bodies and joints together
27 | /// in a joint graph where each body is a node and each joint
28 | /// is an edge. A joint edge belongs to a doubly linked list
29 | /// maintained in each attached body. Each joint has two joint
30 | /// nodes, one for each attached body.
31 |
32 | export class b2JointEdge
33 | {
34 |
35 | public other:b2Body; ///< provides quick access to the other body attached.
36 | public joint:b2Joint; ///< the joint
37 | public prev:b2JointEdge; ///< the previous joint edge in the body's joint list
38 | public next:b2JointEdge; ///< the next joint edge in the body's joint list
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2MouseJointDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Joint, b2JointDef, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | /// Mouse joint definition. This requires a world target point,
28 | /// tuning parameters, and the time step.
29 | export class b2MouseJointDef extends b2JointDef
30 | {
31 | constructor()
32 | {
33 | super()
34 | this.type = b2Joint.e_mouseJoint;
35 | this.maxForce = 0.0;
36 | this.frequencyHz = 5.0;
37 | this.dampingRatio = 0.7;
38 | this.timeStep = 1.0 / 60.0;
39 | }
40 |
41 | /// The initial world target point. This is assumed
42 | /// to coincide with the body anchor initially.
43 | public target:b2Vec2 = new b2Vec2();
44 | /// The maximum constraint force that can be exerted
45 | /// to move the candidate body. Usually you will express
46 | /// as some multiple of the weight (multiplier * mass * gravity).
47 | public maxForce:number;
48 | /// The response speed.
49 | public frequencyHz:number;
50 | /// The damping ratio. 0 = no damping, 1 = critical damping.
51 | public dampingRatio:number;
52 | /// The time step used in the simulation.
53 | public timeStep:number;
54 | }
55 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/Joints/b2PrismaticJointDef.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body, b2Joint, b2JointDef, b2Vec2 } from "../..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | export class b2PrismaticJointDef extends b2JointDef
29 | {
30 | constructor()
31 | {
32 | super()
33 | this.type = b2Joint.e_prismaticJoint;
34 | //localAnchor1.SetZero();
35 | //localAnchor2.SetZero();
36 | this.localAxis1.Set(1.0, 0.0);
37 | this.referenceAngle = 0.0;
38 | this.enableLimit = false;
39 | this.lowerTranslation = 0.0;
40 | this.upperTranslation = 0.0;
41 | this.enableMotor = false;
42 | this.maxMotorForce = 0.0;
43 | this.motorSpeed = 0.0;
44 | }
45 |
46 | public Initialize(b1:b2Body, b2:b2Body, anchor:b2Vec2, axis:b2Vec2) : void
47 | {
48 | this.body1 = b1;
49 | this.body2 = b2;
50 | this.localAnchor1 = this.body1.GetLocalPoint(anchor);
51 | this.localAnchor2 = this.body2.GetLocalPoint(anchor);
52 | this.localAxis1 = this.body1.GetLocalVector(axis);
53 | this.referenceAngle = this.body2.GetAngle() - this.body1.GetAngle();
54 | }
55 |
56 | /// The local anchor point relative to body1's origin.
57 | public localAnchor1:b2Vec2 = new b2Vec2();
58 |
59 | /// The local anchor point relative to body2's origin.
60 | public localAnchor2:b2Vec2 = new b2Vec2();
61 |
62 | /// The local translation axis in body1.
63 | public localAxis1:b2Vec2 = new b2Vec2();
64 |
65 | /// The constrained angle between the bodies: body2_angle - body1_angle.
66 | public referenceAngle:number;
67 |
68 | /// Enable/disable the joint limit.
69 | public enableLimit:boolean;
70 |
71 | /// The lower translation limit, usually in meters.
72 | public lowerTranslation:number;
73 |
74 | /// The upper translation limit, usually in meters.
75 | public upperTranslation:number;
76 |
77 | /// Enable/disable the joint motor.
78 | public enableMotor:boolean;
79 |
80 | /// The maximum motor torque, usually in N-m.
81 | public maxMotorForce:number;
82 |
83 | /// The desired motor speed in radians per second.
84 | public motorSpeed:number;
85 | }
86 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/b2BoundaryListener.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Body } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | /// This is called when a body's shape passes outside of the world boundary.
33 | export class b2BoundaryListener
34 | {
35 |
36 | /// This is called for each body that leaves the world boundary.
37 | /// @warning you can't modify the world inside this callback.
38 | public Violation(body:b2Body) : void{};
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/b2ContactFilter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2FilterData, b2Shape } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | /// Implement this class to provide collision filtering. In other words, you can implement
33 | /// this class if you want finer control over contact creation.
34 | export class b2ContactFilter
35 | {
36 |
37 | /// Return true if contact calculations should be performed between these two shapes.
38 | /// @warning for performance reasons this is only called when the AABBs begin to overlap.
39 | public ShouldCollide(shape1:b2Shape, shape2:b2Shape) : boolean{
40 | var filter1:b2FilterData = shape1.GetFilterData();
41 | var filter2:b2FilterData = shape2.GetFilterData();
42 |
43 | if (filter1.groupIndex == filter2.groupIndex && filter1.groupIndex != 0)
44 | {
45 | return filter1.groupIndex > 0;
46 | }
47 |
48 | var collide:boolean = (filter1.maskBits & filter2.categoryBits) != 0 && (filter1.categoryBits & filter2.maskBits) != 0;
49 | return collide;
50 | }
51 |
52 | public static b2_defaultFilter:b2ContactFilter = new b2ContactFilter();
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/b2ContactListener.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2ContactPoint, b2ContactResult } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | /// Implement this class to get collision results. You can use these results for
33 | /// things like sounds and game logic. You can also get contact results by
34 | /// traversing the contact lists after the time step. However, you might miss
35 | /// some contacts because continuous physics leads to sub-stepping.
36 | /// Additionally you may receive multiple callbacks for the same contact in a
37 | /// single time step.
38 | /// You should strive to make your callbacks efficient because there may be
39 | /// many callbacks per time step.
40 | /// @warning The contact separation is the last computed value.
41 | /// @warning You cannot create/destroy Box2D entities inside these callbacks.
42 | export class b2ContactListener
43 | {
44 |
45 | /// Called when a contact point is added. This includes the geometry
46 | /// and the forces.
47 | public Add(point:b2ContactPoint) : void{};
48 |
49 | /// Called when a contact point persists. This includes the geometry
50 | /// and the forces.
51 | public Persist(point:b2ContactPoint) : void{};
52 |
53 | /// Called when a contact point is removed. This includes the last
54 | /// computed geometry and forces.
55 | public Remove(point:b2ContactPoint) : void{};
56 |
57 | /// Called after a contact point is solved.
58 | public Result(point:b2ContactResult) : void{};
59 | }
60 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/b2DestructionListener.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | import { b2Joint, b2Shape } from "..";
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | /// Joints and shapes are destroyed when their associated
33 | /// body is destroyed. Implement this listener so that you
34 | /// may nullify references to these joints and shapes.
35 | export class b2DestructionListener
36 | {
37 |
38 | /// Called when any joint is about to be destroyed due
39 | /// to the destruction of one of its attached bodies.
40 | public SayGoodbyeJoint(joint:b2Joint) : void{};
41 |
42 | /// Called when any shape is about to be destroyed due
43 | /// to the destruction of its parent body.
44 | public SayGoodbyeShape(shape:b2Shape) : void{};
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/Box2D/Dynamics/b2TimeStep.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 |
20 |
21 |
22 | export class b2TimeStep
23 | {
24 | public dt:number; // time step
25 | public inv_dt:number; // inverse time step (0 if dt == 0).
26 | public dtRatio:number; // dt * inv_dt0
27 | public maxIterations:number;
28 | public warmStarting:boolean;
29 | public positionCorrection:boolean;
30 | }
31 |
--------------------------------------------------------------------------------
/src/Game/CameraMovement.ts:
--------------------------------------------------------------------------------
1 | export class CameraMovement {
2 | public frame: number;
3 | public x: number;
4 | public y: number;
5 | public scale: number;
6 |
7 | constructor(f: number, xOff: number, yOff: number, drawScale: number) {
8 | this.frame = f;
9 | this.x = xOff;
10 | this.y = yOff;
11 | this.scale = drawScale;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Game/Challenge.ts:
--------------------------------------------------------------------------------
1 | import { SandboxSettings } from "../imports";
2 |
3 | export class Challenge {
4 | public settings: SandboxSettings;
5 |
6 | public allParts: Array = new Array();
7 |
8 | public circlesAllowed: boolean = true;
9 | public rectanglesAllowed: boolean = true;
10 | public trianglesAllowed: boolean = true;
11 | public fixedJointsAllowed: boolean = true;
12 | public rotatingJointsAllowed: boolean = true;
13 | public slidingJointsAllowed: boolean = true;
14 | public thrustersAllowed: boolean = true;
15 | public cannonsAllowed: boolean = true;
16 |
17 | public fixateAllowed: boolean = false;
18 | public nonCollidingAllowed: boolean = true;
19 | public mouseDragAllowed: boolean = false;
20 | public botControlAllowed: boolean = true;
21 | public showConditions: boolean = false;
22 | public minDensity: number = -Number.MAX_VALUE;
23 | public maxDensity: number = Number.MAX_VALUE;
24 | public maxRJStrength: number = Number.MAX_VALUE;
25 | public maxRJSpeed: number = Number.MAX_VALUE;
26 | public maxSJStrength: number = Number.MAX_VALUE;
27 | public maxSJSpeed: number = Number.MAX_VALUE;
28 | public maxThrusterStrength: number = Number.MAX_VALUE;
29 |
30 | public cameraX: number = Number.MAX_VALUE;
31 | public cameraY: number = Number.MAX_VALUE;
32 | public zoomLevel: number = Number.MAX_VALUE;
33 |
34 | public buildAreas: Array = new Array();
35 |
36 | public winConditions: Array = new Array();
37 | public lossConditions: Array = new Array();
38 |
39 | public winConditionsAnded: boolean = true;
40 |
41 | constructor(s: SandboxSettings) {
42 | this.settings = s;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Game/Challenges/ControllerRace.ts:
--------------------------------------------------------------------------------
1 | import { ByteArray, ControllerChallenge, ControllerGameGlobals, ControllerSandbox, Database, Resource } from "../../imports";
2 |
3 | export class ControllerRace extends ControllerChallenge {
4 | constructor(cRace: any) {
5 | super();
6 | ControllerChallenge.playChallengeMode = true;
7 | ControllerChallenge.playOnlyMode = true;
8 |
9 | if (!ControllerGameGlobals.playingReplay && cRace) {
10 | cRace.uncompress();
11 | const challenge = Database.ExtractChallengeFromByteArray(cRace);
12 | ControllerRace.challenge = challenge;
13 | ControllerGameGlobals.loadedParts = ControllerRace.challenge.allParts;
14 | ControllerSandbox.settings = ControllerRace.challenge.settings;
15 | }
16 |
17 | this.draw.m_drawXOff = -10000;
18 | this.draw.m_drawYOff = -10000;
19 | ControllerGameGlobals.initZoom = ControllerRace.challenge.zoomLevel;
20 | this.m_physScale = ControllerRace.challenge.zoomLevel;
21 | }
22 |
23 | public Init(e: Event): void {
24 | super.Init(e);
25 | if (!ControllerGameGlobals.viewingUnsavedReplay) this.ShowTutorialDialog(107, true);
26 | }
27 |
28 | public CloseTutorialDialog(num: number): void {
29 | if (num == 107) {
30 | this.ShowTutorialDialog(67);
31 | } else {
32 | super.CloseTutorialDialog(num);
33 | }
34 | }
35 |
36 | private ShowTutorialDialog(num: number, moreButton: boolean = false): void {
37 | this.ShowTutorialWindow(num, 276, 130, moreButton);
38 | }
39 |
40 | public saveButton(): void {
41 | this.ShowDisabledDialog();
42 | }
43 |
44 | public saveReplayButton(): void {
45 | this.ShowDisabledDialog();
46 | if (this.m_scoreWindow && this.m_scoreWindow.visible) this.m_scoreWindow.ShowFader();
47 | }
48 |
49 | public submitButton(): void {
50 | this.ShowDisabledDialog();
51 | if (this.m_scoreWindow && this.m_scoreWindow.visible) this.m_scoreWindow.ShowFader();
52 | }
53 |
54 | public commentButton(robotID: String = "", robotPublic: boolean = false): void {
55 | this.ShowDisabledDialog();
56 | }
57 |
58 | public linkButton(robotID: String = "", robotPublic: boolean = false): void {
59 | this.ShowDisabledDialog();
60 | }
61 |
62 | public embedButton(robotID: String = "", robotPublic: boolean = false): void {
63 | this.ShowDisabledDialog();
64 | }
65 |
66 | public commentReplayButton(replayID: String = "", replayPublic: boolean = false): void {
67 | this.ShowDisabledDialog();
68 | }
69 |
70 | public linkReplayButton(replayID: String = "", replayPublic: boolean = false): void {
71 | this.ShowDisabledDialog();
72 | }
73 |
74 | public embedReplayButton(replayID: String = "", replayPublic: boolean = false): void {
75 | this.ShowDisabledDialog();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/Game/Challenges/ControllerSpaceship.ts:
--------------------------------------------------------------------------------
1 | import { ByteArray } from "../../General/ByteArray";
2 | import { ControllerChallenge, ControllerGameGlobals, ControllerSandbox, Database, Resource } from "../../imports";
3 | import { Challenge } from "../Challenge";
4 |
5 | export class ControllerSpaceship extends ControllerChallenge {
6 | constructor(cSpaceship: ByteArray|null) {
7 | super();
8 | ControllerChallenge.playChallengeMode = true;
9 | ControllerChallenge.playOnlyMode = true;
10 |
11 | if (!ControllerGameGlobals.playingReplay && cSpaceship) {
12 | cSpaceship.uncompress()
13 | const challenge = Database.ExtractChallengeFromByteArray(cSpaceship)
14 | ControllerSpaceship.challenge = challenge;
15 | ControllerGameGlobals.loadedParts = ControllerSpaceship.challenge.allParts;
16 | ControllerSandbox.settings = ControllerSpaceship.challenge.settings;
17 | }
18 |
19 | this.draw.m_drawXOff = -10000;
20 | this.draw.m_drawYOff = 50;
21 | this.m_physScale = 24;
22 | }
23 |
24 | public Init(e: Event): void {
25 | super.Init(e);
26 | if (!ControllerGameGlobals.viewingUnsavedReplay) this.ShowTutorialDialog(107, true);
27 | }
28 |
29 | public CloseTutorialDialog(num: number): void {
30 | if (num == 107) {
31 | this.ShowTutorialDialog(68);
32 | } else {
33 | super.CloseTutorialDialog(num);
34 | }
35 | }
36 |
37 | private ShowTutorialDialog(num: number, moreButton: boolean = false): void {
38 | this.ShowTutorialWindow(num, 276, 130, moreButton);
39 | }
40 |
41 | public saveButton(): void {
42 | this.ShowDisabledDialog();
43 | }
44 |
45 | public saveReplayButton(): void {
46 | this.ShowDisabledDialog();
47 | if (this.m_scoreWindow && this.m_scoreWindow.visible) this.m_scoreWindow.ShowFader();
48 | }
49 |
50 | public submitButton(): void {
51 | this.ShowDisabledDialog();
52 | if (this.m_scoreWindow && this.m_scoreWindow.visible) this.m_scoreWindow.ShowFader();
53 | }
54 |
55 | public commentButton(robotID: String = "", robotPublic: boolean = false): void {
56 | this.ShowDisabledDialog();
57 | }
58 |
59 | public linkButton(robotID: String = "", robotPublic: boolean = false): void {
60 | this.ShowDisabledDialog();
61 | }
62 |
63 | public embedButton(robotID: String = "", robotPublic: boolean = false): void {
64 | this.ShowDisabledDialog();
65 | }
66 |
67 | public commentReplayButton(replayID: String = "", replayPublic: boolean = false): void {
68 | this.ShowDisabledDialog();
69 | }
70 |
71 | public linkReplayButton(replayID: String = "", replayPublic: boolean = false): void {
72 | this.ShowDisabledDialog();
73 | }
74 |
75 | public embedReplayButton(replayID: String = "", replayPublic: boolean = false): void {
76 | this.ShowDisabledDialog();
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/Game/ContactFilter.ts:
--------------------------------------------------------------------------------
1 | import { b2ContactFilter } from "../Box2D";
2 |
3 | export class ContactFilter extends b2ContactFilter {
4 | constructor() {
5 | super();
6 | }
7 |
8 | public ShouldCollide(shape1, shape2):boolean {
9 | if ((shape1.GetUserData() && shape1.GetUserData().isSandbox) || (shape2.GetUserData() && shape2.GetUserData().isSandbox)) return true;
10 |
11 | if (shape1.GetUserData() && shape2.GetUserData() && !shape1.GetUserData().collide && (!shape1.GetUserData().editable || shape2.GetUserData().editable) && (shape1.GetUserData().isPiston == -1 || shape2.GetUserData().isPiston == -1)) return false;
12 | if (shape1.GetUserData() && shape2.GetUserData() && !shape2.GetUserData().collide && (!shape2.GetUserData().editable || shape1.GetUserData().editable) && (shape1.GetUserData().isPiston == -1 || shape2.GetUserData().isPiston == -1)) return false;
13 |
14 | if (shape1.GetUserData() && shape2.GetUserData() && shape1.GetUserData().isPiston != -1 && shape2.GetUserData().isPiston != -1 && !shape1.GetUserData().collide && (!shape1.GetUserData().editable || shape2.GetUserData().editable)) return false;
15 | if (shape1.GetUserData() && shape2.GetUserData() && shape1.GetUserData().isPiston != -1 && shape2.GetUserData().isPiston != -1 && !shape2.GetUserData().collide && (!shape2.GetUserData().editable || shape1.GetUserData().editable)) return false;
16 |
17 | if (shape1.GetUserData() && shape2.GetUserData() && shape1.GetUserData().isPiston != -1 && shape2.GetUserData().isPiston != -1 && shape1.GetUserData().isPiston == shape2.GetUserData().isPiston && shape1.GetBody() != shape2.GetBody() && shape1.m_filter.groupIndex == shape2.m_filter.groupIndex) return true;
18 |
19 | return super.ShouldCollide(shape1, shape2);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Game/ContactListener.ts:
--------------------------------------------------------------------------------
1 | import { b2ContactListener } from "../Box2D";
2 | import { ControllerGame } from "../imports";
3 |
4 | export class ContactListener extends b2ContactListener {
5 | private cont: ControllerGame;
6 |
7 | constructor(contr: ControllerGame) {
8 | super();
9 | this.cont = contr;
10 | }
11 |
12 | /// Called when a contact point is added. This includes the geometry
13 | /// and the forces.
14 | public BeginContact(point): void {
15 | this.cont.ContactAdded(point);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Game/Graphics/Gradient.ts:
--------------------------------------------------------------------------------
1 | import { Texture } from "pixi.js";
2 |
3 | export class Gradient {
4 | static getLinearGradientTexture([startColor, endColor]: Array, length: number = 512, dir: string = 'to top'): Texture {
5 | const steps = length;
6 | const canvas = document.createElement("canvas");
7 |
8 | if (dir === 'to top' || dir === 'to bottom') {
9 | canvas.width = 1;
10 | canvas.height = steps;
11 | } else {
12 | canvas.width = steps;
13 | canvas.height = 1;
14 | }
15 |
16 | const ctx = canvas.getContext("2d");
17 | const gradient = ctx.createLinearGradient(0, 0, 0, steps);
18 |
19 | if (dir === 'to top' || dir === 'to right') {
20 | gradient.addColorStop(0, startColor);
21 | gradient.addColorStop(1, endColor);
22 | } else {
23 | gradient.addColorStop(0, endColor);
24 | gradient.addColorStop(1, startColor);
25 | }
26 |
27 | ctx.fillStyle = gradient;
28 | ctx.fillRect(0, 0, 1, steps);
29 |
30 | return Texture.from(canvas);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Game/KeyPress.ts:
--------------------------------------------------------------------------------
1 | export class KeyPress {
2 | public frame: number;
3 | public key: number;
4 |
5 | constructor(f: number, k: number) {
6 | this.frame = f;
7 | this.key = k;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Game/LossCondition.ts:
--------------------------------------------------------------------------------
1 | import { Condition } from "../imports";
2 |
3 | export class LossCondition extends Condition {
4 | public immediate: boolean;
5 |
6 | constructor(n: string, s: number, o: number, i: boolean) {
7 | super(n, s, o);
8 | this.immediate = i;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Game/Replay.ts:
--------------------------------------------------------------------------------
1 | import { Controller } from "../imports";
2 |
3 | export class Replay {
4 | public cameraMovements: Array;
5 | public keyPresses: Array;
6 | public syncPoints: Array;
7 | public version: string;
8 | public numFrames: number;
9 | public cont: Controller = null;
10 |
11 | public syncPointIndex: number = 0;
12 | public cameraMovementIndex: number = 0;
13 | public keyPressIndex: number = 0;
14 |
15 | public constructor(m: Array, s: Array, k: Array, f: number, v: string) {
16 | this.cameraMovements = m;
17 | this.syncPoints = s;
18 | this.keyPresses = k;
19 | this.numFrames = f;
20 | this.version = v;
21 | }
22 |
23 | public Update(frame: number): boolean {
24 | while (
25 | this.cameraMovementIndex < this.cameraMovements.length &&
26 | this.cameraMovements[this.cameraMovementIndex].frame == frame
27 | ) {
28 | if (this.cont) this.cont.MoveCameraForReplay(this.cameraMovements[this.cameraMovementIndex]);
29 | this.cameraMovementIndex++;
30 | }
31 | if (this.syncPointIndex < this.syncPoints.length) {
32 | if (frame >= this.syncPoints[this.syncPointIndex].frame) {
33 | var syncPoint: Object = this.syncPoints[this.syncPointIndex];
34 | if (this.cont) this.cont.SyncReplay(syncPoint);
35 | this.syncPointIndex++;
36 | } else {
37 | var syncPoint1: Object = this.syncPoints[this.syncPointIndex - 1];
38 | var syncPoint2: Object = this.syncPoints[this.syncPointIndex];
39 | if (this.cont) this.cont.SyncReplay2(syncPoint1, syncPoint2);
40 | }
41 | }
42 | while (this.keyPressIndex < this.keyPresses.length && this.keyPresses[this.keyPressIndex].frame == frame) {
43 | if (this.cont) this.cont.keyInput(this.keyPresses[this.keyPressIndex].key, true);
44 | this.keyPressIndex++;
45 | }
46 | return frame >= this.numFrames;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Game/ReplaySyncPoint.ts:
--------------------------------------------------------------------------------
1 | export class ReplaySyncPoint {
2 | public frame: number = 0;
3 | public positions: Array = new Array();
4 | public angles: Array = new Array();
5 | public cannonballPositions: Array = new Array();
6 | }
7 |
--------------------------------------------------------------------------------
/src/Game/Robot.ts:
--------------------------------------------------------------------------------
1 | import { Challenge, SandboxSettings } from "../imports";
2 |
3 | export class Robot {
4 | public allParts: Array;
5 | public settings: SandboxSettings = null;
6 | public challenge: Challenge = null;
7 |
8 | public cameraX: number = Number.MAX_VALUE;
9 | public cameraY: number = Number.MAX_VALUE;
10 | public zoomLevel: number = Number.MAX_VALUE;
11 |
12 | constructor(
13 | parts: Array,
14 | s: SandboxSettings = null,
15 | x: number = Number.MAX_VALUE,
16 | y: number = Number.MAX_VALUE,
17 | zoom: number = Number.MAX_VALUE
18 | ) {
19 | this.allParts = parts;
20 | this.settings = s;
21 | this.cameraX = x;
22 | this.cameraY = y;
23 | this.zoomLevel = zoom;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Game/SandboxSettings.ts:
--------------------------------------------------------------------------------
1 | export class SandboxSettings {
2 | public gravity: number;
3 | public size: number;
4 | public terrainType: number;
5 | public terrainTheme: number;
6 | public background: number;
7 | public backgroundR: number;
8 | public backgroundG: number;
9 | public backgroundB: number;
10 |
11 | public static SIZE_SMALL: number = 0;
12 | public static SIZE_MEDIUM: number = 1;
13 | public static SIZE_LARGE: number = 2;
14 |
15 | public static TERRAIN_LAND: number = 0;
16 | public static TERRAIN_BOX: number = 1;
17 | public static TERRAIN_EMPTY: number = 2;
18 |
19 | public static TERRAIN_GRASS: number = 0;
20 | public static TERRAIN_DIRT: number = 1;
21 | public static TERRAIN_SAND: number = 2;
22 | public static TERRAIN_ROCK: number = 3;
23 | public static TERRAIN_SNOW: number = 4;
24 | public static TERRAIN_MOON: number = 5;
25 | public static TERRAIN_MARS: number = 6;
26 |
27 | public static BACKGROUND_SKY: number = 0;
28 | public static BACKGROUND_SPACE: number = 1;
29 | public static BACKGROUND_NIGHT: number = 2;
30 | public static BACKGROUND_DUSK: number = 3;
31 | public static BACKGROUND_MARS: number = 4;
32 | public static BACKGROUND_SUNSET: number = 5;
33 | public static BACKGROUND_SOLID_COLOUR: number = 6;
34 |
35 | constructor(
36 | grav: number,
37 | s: number,
38 | type: number,
39 | theme: number,
40 | bg: number,
41 | r: number = 0,
42 | g: number = 0,
43 | b: number = 0
44 | ) {
45 | this.gravity = grav;
46 | this.size = s;
47 | this.terrainType = type;
48 | this.terrainTheme = theme;
49 | this.background = bg;
50 | this.backgroundR = r;
51 | this.backgroundG = g;
52 | this.backgroundB = b;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Game/WinCondition.ts:
--------------------------------------------------------------------------------
1 | import { Condition } from "../imports";
2 |
3 | export class WinCondition extends Condition {
4 | constructor(n: string, s: number, o: number) {
5 | super(n, s, o);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/General/AMF/AMFalternatives.md:
--------------------------------------------------------------------------------
1 | AMF alternatives
2 |
3 | AMF is one of the few Data exchange formats that went pretty popular. AMF serializes your data into binary format, which means that it's not human readable. There's a few libraries like AMF, which is what you'll find in this file if you're interested in them and learning them. I do not own any of the listed modules.
4 |
5 | Examples for Javascript
6 |
7 | - asn1js
8 | - oer-utils
9 | - binn.js
10 | - hessian.js
11 | - js-xdr
12 | - node-cbor
13 | - borc
14 | - smile-js
15 |
--------------------------------------------------------------------------------
/src/General/ByteArrayEnums.ts:
--------------------------------------------------------------------------------
1 | export const CompressionAlgorithm = { DEFLATE: "deflate", LZMA: "lzma", ZLIB: "zlib" };
2 | export const Endian = { LITTLE_ENDIAN: "LE", BIG_ENDIAN: "BE" };
3 | export const ObjectEncoding = { AMF0: 0, AMF3: 3 };
4 |
--------------------------------------------------------------------------------
/src/General/FRateLimiter.as:
--------------------------------------------------------------------------------
1 | //===========================================================
2 | //=========================================================//
3 | // -=ANTHEM=-
4 | // file: frameLimiter.as
5 | //
6 | // copyright: Matthew Bush 2007
7 | //
8 | // notes: limits framerate
9 | //
10 | //=========================================================//
11 | //===========================================================
12 |
13 |
14 |
15 | //===========================================================
16 | // frame limiter
17 | //===========================================================
18 |
19 | package General{
20 |
21 |
22 | import flash.utils.getTimer;
23 |
24 |
25 | public class FRateLimiter{
26 |
27 |
28 | //======================
29 | // limit frame function
30 | //======================
31 | static public function limitFrame(maxFPS:uint):void{
32 |
33 | var fTime:uint = 1000 / maxFPS;
34 |
35 | while(Math.abs(newT - oldT) < fTime){
36 | newT = getTimer();
37 | }
38 | oldT = getTimer();
39 |
40 | }
41 |
42 | //======================
43 | // member vars
44 | //======================
45 | private static var oldT:uint = getTimer();
46 | private static var newT:uint = oldT;
47 | }
48 |
49 | }
--------------------------------------------------------------------------------
/src/General/FpsCounter.ts:
--------------------------------------------------------------------------------
1 | //===========================================================
2 | //=========================================================//
3 | // -=ANTHEM=-
4 | // file: .as
5 | //
6 | // copyright: Matthew Bush 2007
7 | //
8 | // notes:
9 | //
10 | //=========================================================//
11 | //===========================================================
12 |
13 | import { Container, Text } from "pixi.js";
14 |
15 | //===========================================================
16 | // FPS COUNTER CLASS
17 | //===========================================================
18 | export class FpsCounter extends Container {
19 | //======================
20 | // constructor
21 | //======================
22 | constructor() {
23 | super();
24 | // create text field
25 | this.textBox = new Text("...");
26 | this.textBox.style.fill = "#aa1144";
27 |
28 | this.textBox2 = new Text("...");
29 | this.textBox2.width = 150;
30 | this.textBox2.style.fill = "#aa1144";
31 | this.textBox2.y = 15;
32 | // set initial lastTime
33 | this.oldT = window.performance.now();
34 |
35 | this.addChild(this.textBox);
36 | this.addChild(this.textBox2);
37 | }
38 |
39 | //======================
40 | // update function
41 | //======================
42 | public update(): void {
43 | var newT: number = window.performance.now();
44 | var f1: number = newT - this.oldT;
45 | this.mfpsCount += f1;
46 | if (this.avgCount < 1) {
47 | this.textBox.text = String(Math.round(1000 / (this.mfpsCount / 30)) + " fps average");
48 | this.avgCount = 30;
49 | this.mfpsCount = 0;
50 | }
51 | this.avgCount--;
52 | this.oldT = window.performance.now();
53 | }
54 |
55 | public updatePhys(oldT2: number): void {
56 | var newT: number = window.performance.now();
57 | var f1: number = newT - oldT2;
58 | this.mfpsCount2 += f1;
59 | if (this.avgCount2 < 1) {
60 | this.textBox2.text = String(
61 | "Physics step: " +
62 | Math.round(this.mfpsCount2 / 30) +
63 | " ms (" +
64 | Math.round(1000 / (this.mfpsCount2 / 30)) +
65 | " fps)"
66 | );
67 | this.avgCount2 = 30;
68 | this.mfpsCount2 = 0;
69 | }
70 | this.avgCount2--;
71 | }
72 |
73 | //======================
74 | // private variables
75 | //======================
76 | private textBox: Text;
77 | private textBox2: Text;
78 | private mfpsCount: number = 0;
79 | private mfpsCount2: number = 0;
80 | private avgCount: number = 30;
81 | private avgCount2: number = 30;
82 | private oldT: number;
83 | }
84 |
--------------------------------------------------------------------------------
/src/General/LZW.as:
--------------------------------------------------------------------------------
1 | package General
2 | {
3 | import flash.utils.ByteArray;
4 |
5 | public class LZW
6 | {
7 | public static function compress(str:ByteArray):ByteArray
8 | {
9 | str.position = 0;
10 | var dico:Array = new Array();
11 | for (var i:int = 0; i < 256; i++)
12 | {
13 | dico[String.fromCharCode(i)] = i;
14 | }
15 | var res:ByteArray = new ByteArray();
16 | var len:Number = str.length;
17 | var nbChar:Number = 256;
18 | var buffer:String = "";
19 | for (i = 0; i < len; i++)
20 | {
21 | var current:String = str.readUTFBytes(1);
22 | if (dico[buffer + current] !== undefined)
23 | {
24 | buffer += current;
25 | }
26 | else
27 | {
28 | res.writeUTFBytes(String.fromCharCode(dico[buffer]));
29 | dico[buffer + current] = nbChar;
30 | nbChar++;
31 | buffer = current;
32 | }
33 | }
34 | return res;
35 | }
36 | public static function decompress(str:ByteArray):ByteArray
37 | {
38 | var dico:Array = new Array();
39 | for (var i:int = 0; i < 256; i++)
40 | {
41 | var c:String = String.fromCharCode(i);
42 | dico[i] = c;
43 | }
44 | var length:Number = str.length;
45 | var nbChar:Number = 256;
46 | var buffer:String = "";
47 | var chaine:String = "";
48 | var result:ByteArray = new ByteArray();
49 | for (i = 0; i < length; i++)
50 | {
51 | var code:Number = str.readUTFBytes(1).charCodeAt(0);
52 | var current:String = dico[code];
53 | if (buffer == "")
54 | {
55 | buffer = current;
56 | result.writeUTFBytes(current);
57 | }
58 | else
59 | {
60 | if (code <= 255)
61 | {
62 | result.writeUTFBytes(current);
63 | chaine = buffer + current;
64 | dico[nbChar] = chaine;
65 | nbChar++;
66 | buffer = current;
67 | }
68 | else
69 | {
70 | chaine = dico[code];
71 | if (chaine == undefined) chaine = buffer + buffer.slice(0,1);
72 | result.writeUTFBytes(chaine);
73 | dico[nbChar] = buffer + chaine.slice(0, 1);
74 | nbChar++;
75 | buffer = chaine;
76 |
77 | }
78 | }
79 | }
80 | return result;
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/src/Gui/ExportWindow.ts:
--------------------------------------------------------------------------------
1 | import { Text, TextStyle } from "pixi.js";
2 | import { Controller, GuiButton, GuiTextArea, GuiWindow, Main } from "../imports";
3 |
4 | export class ExportWindow extends GuiWindow
5 | {
6 | private cont:Controller;
7 | private msgArea:Text;
8 | private linkArea:GuiTextArea;
9 | private okButton:GuiButton;
10 | private copyButton:GuiButton;
11 |
12 | constructor(contr:Controller, exportStr:string, robotStr:string)
13 | {
14 | super(244, 83, 312, 434, false);
15 |
16 | this.cont = contr;
17 | var format:TextStyle = new TextStyle();
18 | format.fontFamily = Main.GLOBAL_FONT;
19 | format.fill = 0x242930;
20 | this.msgArea = new Text('');
21 | this.msgArea.x = 15;
22 | this.msgArea.y = 25;
23 | this.msgArea.text = "The IncrediBots servers are going to be shut down\nsoon, thus saving to the servers has been disabled.\n\nInstead, you may export your " + robotStr + " to a file.\nTo do so, copy and paste the text below into a file;\nit can be restored by clicking \"Load\", then \"Import.\"\n\nNOTE: Make sure to do this with all of your\nimportant robots, replays, and challenges, as\nsoon this will be the only way to access them!";
24 | format.fontSize = 12;
25 | format.align = 'center';
26 | this.msgArea.style = format;
27 | this.addChild(this.msgArea);
28 |
29 | format = new TextStyle();
30 | format.fontSize = 10;
31 | this.linkArea = new GuiTextArea(15, 185, 265, 160, format);
32 | this.linkArea.text = exportStr;
33 | this.linkArea.textInput.text = exportStr;
34 | // this.linkArea.editable = false;
35 | this.linkArea.on('focus', () => this.linkAreaClicked())
36 | this.addChild(this.linkArea);
37 |
38 | this.okButton = new GuiButton("OK", 125, 385, 50, 30, () => this.cont.HideExportDialog(), GuiButton.PURPLE);
39 | this.addChild(this.okButton);
40 | this.copyButton = new GuiButton("Copy to Clipboard", 80, 350, 140, 35, () => this.copyButtonPressed(), GuiButton.ORANGE);
41 | this.addChild(this.copyButton);
42 | }
43 |
44 | private copyButtonPressed():void {
45 | this.linkArea.textInput.select();
46 | document.execCommand("copy");
47 | }
48 |
49 | private linkAreaClicked():void {
50 | this.linkArea.textInput.select();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Gui/GuiComboboxItem.ts:
--------------------------------------------------------------------------------
1 | import PIXIsound from "pixi-sound";
2 | import { Container, Sprite, Text, TextStyle, Texture } from "pixi.js";
3 | import { Main, Resource } from "../imports";
4 | type Sound = PIXIsound.Sound;
5 |
6 | export class GuiComboboxItem extends Container {
7 | public static rolloverSound: Sound = Resource.cRoll;
8 | public static clickSound: Sound = Resource.cClick;
9 |
10 | public label: Text = new Text("");
11 | public background: Sprite = new Sprite();
12 |
13 | private upTexture: Texture;
14 | private overTexture: Texture;
15 | private downTexture: Texture;
16 |
17 | private _selected: boolean = false;
18 | private _text: string = "";
19 |
20 | set selected(value: boolean) {
21 | this._selected = value;
22 | if (this._selected) this.background.texture = this.downTexture;
23 | else this.background.texture = this.upTexture;
24 | }
25 |
26 | get selected(): boolean {
27 | return this._selected;
28 | }
29 |
30 | set text(value: string) {
31 | this._text = value;
32 | this.label.text = this._text;
33 | }
34 |
35 | get text(): string {
36 | return this._text;
37 | }
38 |
39 | constructor(text: string, xPos: number, yPos: number, w: number, h: number) {
40 | super();
41 | this.width = w;
42 | this.height = h;
43 | this.x = xPos;
44 | this.y = yPos;
45 | this.buttonMode = true;
46 | this.interactive = true;
47 | this.text = text;
48 |
49 | this.upTexture = Resource.cGuiListboxBase;
50 | this.overTexture = Resource.cGuiListboxRoll;
51 | this.downTexture = Resource.cGuiListboxClick;
52 |
53 | const style = new TextStyle();
54 | style.fontSize = 11;
55 | style.fill = "#573D40";
56 | style.fontFamily = Main.GLOBAL_FONT;
57 | style.align = "left";
58 |
59 | this.background.texture = this.upTexture;
60 | this.background.width = w;
61 | this.background.height = h;
62 | this.addChild(this.background);
63 |
64 | this.label.style = style;
65 | this.label.anchor.set(0, 0.5);
66 | this.label.x = 10;
67 | this.label.y = h / 2;
68 | this.addChild(this.label);
69 |
70 | this.on("click", (event: any) => {
71 | if (Main.enableSound) {
72 | GuiComboboxItem.clickSound.stop();
73 | GuiComboboxItem.clickSound.volume = 0.2;
74 | GuiComboboxItem.clickSound.play();
75 | }
76 | event.stopPropagation();
77 |
78 | this.emit("select", event);
79 | })
80 | .on("mousedown", (event: any) => {
81 | this.background.texture = this.downTexture;
82 | })
83 | .on("mouseover", (event: any) => {
84 | this.background.texture = this.selected ? this.downTexture : this.overTexture;
85 | if (Main.enableSound) {
86 | GuiComboboxItem.rolloverSound.stop();
87 | GuiComboboxItem.rolloverSound.volume = 0.2;
88 | GuiComboboxItem.rolloverSound.play();
89 | }
90 | })
91 | .on("mouseout", (event: any) => {
92 | this.background.texture = this.selected ? this.downTexture : this.upTexture;
93 | });
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/Gui/GuiList.ts:
--------------------------------------------------------------------------------
1 | import { Container, NineSlicePlane, Text, TextStyle } from "pixi.js";
2 | import { Main, Resource } from '../imports';
3 | import { Scrollbox } from "pixi-scrollbox";
4 |
5 | export class GuiList extends Container {
6 | private background: NineSlicePlane;
7 | private scrollbox: Scrollbox;
8 | private textStyle: TextStyle;
9 | private _items: Array = [];
10 | private _renderedItems: Array = [];
11 | public selectedIndex: number|null = 0;
12 |
13 | get length() {
14 | return this._items.length
15 | }
16 |
17 | constructor(width: number, height: number, style: TextStyle) {
18 | super()
19 | this._width = width
20 | this._height = height
21 | this.textStyle = style
22 |
23 | this.scrollbox = new Scrollbox({
24 | boxWidth: width,
25 | boxHeight: height,
26 | interaction: Main.renderer.renderer.plugins.interaction,
27 | scrollbarForeground: 0xa08ed2,
28 | scrollbarBackground: 0xb7aae3
29 | })
30 |
31 | this.background = new NineSlicePlane(Resource.cGuiTextAreaBase, 50, 20, 50, 20);
32 |
33 | this.addChild(this.background)
34 | this.addChild(this.scrollbox)
35 | this.draw()
36 | }
37 |
38 | public clear() {
39 | this._items = []
40 | this.draw()
41 | }
42 |
43 | public push(item: any) {
44 | this._items.push(item)
45 | this.draw()
46 | }
47 |
48 | private draw() {
49 | this.scrollbox.boxWidth = this._width
50 | this.scrollbox.boxHeight = this._height
51 | this.scrollbox.update()
52 |
53 | this.background.width = this._width
54 | this.background.height = this._height
55 |
56 | const containerHeight = 20
57 | this.scrollbox.content.removeChildren()
58 | this._renderedItems = []
59 | this._renderedItems = this._items.map((item, index) => {
60 | const container = new Container()
61 | const background = new NineSlicePlane(index === this.selectedIndex ? Resource.cGuiListboxWideClick : Resource.cGuiListboxWideBase, 230, 10, 230, 10)
62 | const label = new Text(item.label)
63 | label.anchor.set(0, 0.5)
64 | label.x = 5
65 | label.y = 20 / 2
66 | label.style = this.textStyle
67 | background.width = this.width
68 | background.height = containerHeight
69 |
70 | container.interactive = true
71 | container.y = index * containerHeight
72 | container.addChild(background)
73 | container.addChild(label)
74 |
75 | container.on('mouseover', () => background.texture = Resource.cGuiListboxWideRoll)
76 | container.on('mouseout', () => background.texture = index === this.selectedIndex ? Resource.cGuiListboxWideClick : Resource.cGuiListboxWideBase)
77 | container.on('click', () => {
78 | this.selectedIndex = index
79 | this.draw()
80 | })
81 | return container
82 | })
83 |
84 | this._renderedItems.map(item => this.scrollbox.content.addChild(item))
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/Gui/GuiTextArea.ts:
--------------------------------------------------------------------------------
1 | import TextInput from "pixi-text-input";
2 | import { Container, Sprite, TextStyle, Texture, TilingSprite } from "pixi.js";
3 | import { Main, Resource } from "../imports";
4 |
5 | export class GuiTextArea extends Container {
6 | private baseSkin: Texture;
7 | private rollSkin: Texture;
8 |
9 | public textInput: TextInput;
10 |
11 | public text: string = "";
12 |
13 | get editable() {
14 | return !this.textInput.disabled
15 | }
16 |
17 | set editable(value) {
18 | this.textInput.disabled = !value
19 | }
20 |
21 | constructor(xPos: number, yPos: number, w: number, h: number, format: TextStyle | null = null) {
22 | super();
23 | this.x = xPos;
24 | this.y = yPos;
25 |
26 | this.baseSkin = Resource.cGuiTextAreaBase;
27 | this.rollSkin = Resource.cGuiTextAreaRoll;
28 |
29 | if (!format) format = new TextStyle();
30 | format.fontFamily = Main.GLOBAL_FONT;
31 | format.fill = "#4C3D57";
32 |
33 | const backgroundContainer = new Container();
34 | const backgroundSprite = new Sprite(this.baseSkin);
35 | backgroundSprite.width = w;
36 | backgroundSprite.height = h;
37 | backgroundContainer.addChild(backgroundSprite);
38 |
39 | this.textInput = new TextInput({
40 | input: {
41 | multiline: true,
42 | fontSize: `${format.fontSize}pt`,
43 | color: format.fill,
44 | zIndex: 1000,
45 | width: `${w - 20}px`,
46 | height: `${h - 20}px`,
47 | padding: `10px`,
48 | },
49 | box: (w: number, h: number, state: string) => {
50 | const backgroundSprite = new Sprite();
51 | backgroundSprite.texture = this.baseSkin;
52 | backgroundSprite.width = w;
53 | backgroundSprite.height = h;
54 |
55 | if (state === "DEFAULT") backgroundSprite.texture = this.baseSkin;
56 | if (state === "FOCUSED") backgroundSprite.texture = this.rollSkin;
57 | if (state === "DISABLED") backgroundSprite.texture = this.baseSkin;
58 |
59 | return backgroundSprite;
60 | },
61 | });
62 |
63 | this.textInput.on("input", (text: string) => {
64 | this.text = text;
65 | this.emit("change", text);
66 | });
67 |
68 | this.textInput.on("focus", () => {
69 | this.emit("focus")
70 | });
71 |
72 | this.textInput.on("blur", () => {
73 | this.emit("blur")
74 | });
75 |
76 | this.addChild(this.textInput);
77 | }
78 |
79 | focus() {
80 | this.textInput.focus()
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/Gui/GuiTextInput.as:
--------------------------------------------------------------------------------
1 | public class GuiTextInput extends TextInput
2 | {
3 | private var baseSkin:BitmapAsset = GuiTextArea.textAreaBase();
4 | private var rollSkin:BitmapAsset = GuiTextArea.textAreaRoll();
5 | private var isMouseOver:Boolean = false;
6 | private var hasFocus:Boolean = false;
7 |
8 | public function GuiTextInput(xPos:Number, yPos:Number, w:Number, format:TextFormat = null)
9 | {
10 | focusEnabled = false;
11 | x = xPos;
12 | y = yPos;
13 | width = w;
14 | if (!format) format = new TextFormat();
15 | format.font = Main.GLOBAL_FONT;
16 | format.color = 0x4C3D57;
17 | setStyle("textFormat", format);
18 | setStyle("disabledTextFormat", format);
19 | setStyle("upSkin", baseSkin);
20 | setStyle("disabledSkin", GuiTextArea.textAreaDisabled());
21 | addEventListener(MouseEvent.MOUSE_OVER, mouseOver, false, 0, true);
22 | addEventListener(MouseEvent.MOUSE_OUT, mouseOut, false, 0, true);
23 | addEventListener(FocusEvent.FOCUS_IN, gotFocus, false, 0, true);
24 | addEventListener(FocusEvent.FOCUS_OUT, lostFocus, false, 0, true);
25 | addEventListener(ComponentEvent.ENTER, enterPressed, false, 0, true);
26 | }
27 |
28 | private function mouseOver(e:MouseEvent):void {
29 | if (enabled && editable) {
30 | e.currentTarget.setStyle("upSkin", rollSkin);
31 | isMouseOver = true;
32 | }
33 | }
34 |
35 | private function mouseOut(e:MouseEvent):void {
36 | if (!hasFocus) e.currentTarget.setStyle("upSkin", baseSkin);
37 | isMouseOver = false;
38 | }
39 |
40 | private function gotFocus(e:Event):void {
41 | if (enabled && editable) {
42 | e.currentTarget.setStyle("upSkin", rollSkin);
43 | hasFocus = true;
44 | }
45 | }
46 |
47 | private function lostFocus(e:Event):void {
48 | if (!isMouseOver) e.currentTarget.setStyle("upSkin", baseSkin);
49 | hasFocus = false;
50 | }
51 |
52 | private function enterPressed(e:Event):void {
53 | stage.focus = null;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Gui/ImportWindow.ts:
--------------------------------------------------------------------------------
1 | import { Text, TextStyle } from "pixi.js";
2 | import { Controller, Database, GuiButton, GuiTextArea, GuiWindow, Main } from "../imports";
3 |
4 | export class ImportWindow extends GuiWindow {
5 | public static TYPE_ROBOT: number = 0;
6 | public static TYPE_REPLAY: number = 1;
7 | public static TYPE_CHALLENGE: number = 2;
8 |
9 | private cont: Controller;
10 | private msgArea: Text;
11 | private linkArea: GuiTextArea;
12 | private importButton: GuiButton;
13 | private cancelButton: GuiButton;
14 | private type: number;
15 |
16 | constructor(contr: Controller, iType: number) {
17 | super(244, 83, 312, 434, false);
18 | this.cont = contr;
19 | this.type = iType;
20 | var format: TextStyle = new TextStyle();
21 | format.fontFamily = Main.GLOBAL_FONT;
22 | format.fill = "#242930";
23 | format.fontSize = 12;
24 | format.align = "center";
25 | this.msgArea = new Text("");
26 | this.msgArea.x = 300 / 2;
27 | this.msgArea.y = 85 / 2;
28 | this.msgArea.anchor.set(0.5, 0.5);
29 | this.msgArea.text =
30 | "Copy and paste the text you got from exporting\nyour " +
31 | (this.type == ImportWindow.TYPE_ROBOT
32 | ? "robot"
33 | : this.type == ImportWindow.TYPE_REPLAY
34 | ? "replay"
35 | : "challenge") +
36 | ' in the box below, then press "Import."';
37 | this.msgArea.style = format;
38 | this.addChild(this.msgArea);
39 |
40 | format = new TextStyle();
41 | format.fontSize = 10;
42 | this.linkArea = new GuiTextArea(15, 85, 265, 260, format);
43 | this.addChild(this.linkArea);
44 |
45 | this.importButton = new GuiButton("Import", 100, 345, 100, 35, () => this.doImport(), GuiButton.ORANGE);
46 | this.addChild(this.importButton);
47 | this.cancelButton = new GuiButton(
48 | "Cancel",
49 | 100,
50 | 375,
51 | 100,
52 | 35,
53 | () => this.cont.HideImportDialog(),
54 | GuiButton.PURPLE
55 | );
56 | this.addChild(this.cancelButton);
57 | }
58 |
59 | private async doImport() {
60 | if (this.linkArea.text.length > 0) {
61 | this.cont.HideImportDialog();
62 | if (this.type == ImportWindow.TYPE_ROBOT) {
63 | this.cont.processLoadedRobot(await Database.ImportRobot(this.linkArea.text));
64 | } else if (this.type == ImportWindow.TYPE_REPLAY) {
65 | this.cont.processLoadedReplay(await Database.ImportReplay(this.linkArea.text));
66 | } else if (this.type == ImportWindow.TYPE_CHALLENGE) {
67 | this.cont.processLoadedChallenge(await Database.ImportChallenge(this.linkArea.text));
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/Gui/LoadWindow.ts:
--------------------------------------------------------------------------------
1 | import { Text, TextStyle } from "pixi.js";
2 | import { ControllerGame, GuiButton, GuiWindow, ImportWindow, Main } from "../imports";
3 |
4 | export class LoadWindow extends GuiWindow
5 | {
6 | private cont:ControllerGame;
7 |
8 | constructor(contr:ControllerGame)
9 | {
10 | super(323, 150, 154, 290);
11 | this.cont = contr;
12 | var header:Text = new Text("");
13 | header.text = "Load What?";
14 | header.anchor.set(0.5, 0.5)
15 | header.x = 7 + 140/2;
16 | header.y = 10 + 30 / 2;
17 | var format:TextStyle = new TextStyle();
18 | format.fill = 0x242930;
19 | format.fontSize = 14;
20 | format.align = 'center';
21 | format.fontFamily = Main.GLOBAL_FONT;
22 | header.style = format;
23 | this.addChild(header);
24 | format = new TextStyle();
25 | format.fontSize = 14;
26 | var button:GuiButton = new GuiButton("Load Robot", 7, 30, 140, 45, () => this.loadRobot(), GuiButton.BLUE, format);
27 | button.disabled = true
28 | this.addChild(button);
29 | button = new GuiButton("Load Replay", 7, 65, 140, 45, () => this.loadReplay(), GuiButton.BLUE, format);
30 | button.disabled = true
31 | this.addChild(button);
32 | button = new GuiButton("Load Challenge", 7, 100, 140, 45, () => this.loadChallenge(), GuiButton.BLUE, format);
33 | button.disabled = true
34 | this.addChild(button);
35 | button = new GuiButton("Import Robot", 7, 135, 140, 45, () => this.importRobot(), GuiButton.ORANGE, format);
36 | this.addChild(button);
37 | button = new GuiButton("Import Replay", 7, 170, 140, 45, () => this.importReplay(), GuiButton.ORANGE, format);
38 | this.addChild(button);
39 | button = new GuiButton("Import Challenge", 7, 205, 140, 45, () => this.importChallenge(), GuiButton.ORANGE, format);
40 | this.addChild(button);
41 | format = new TextStyle();
42 | format.fontSize = 12;
43 | button = new GuiButton("Cancel", 32, 245, 90, 35, () => this.cancel(), GuiButton.PURPLE, format);
44 | this.addChild(button);
45 | }
46 |
47 | private loadRobot():void {
48 | this.cancel();
49 | this.cont.loadRobotButton(false);
50 | }
51 |
52 | private loadReplay():void {
53 | this.cancel();
54 | this.cont.loadReplayButton(false);
55 | }
56 |
57 | private loadChallenge():void {
58 | this.cancel();
59 | this.cont.loadChallengeButton(false);
60 | }
61 |
62 | private importRobot():void {
63 | this.cancel();
64 | this.cont.ShowImportWindow(ImportWindow.TYPE_ROBOT);
65 | }
66 |
67 | private importReplay():void {
68 | this.cancel();
69 | this.cont.ShowImportWindow(ImportWindow.TYPE_REPLAY);
70 | }
71 |
72 | private importChallenge():void {
73 | this.cancel();
74 | this.cont.ShowImportWindow(ImportWindow.TYPE_CHALLENGE);
75 | }
76 |
77 | private cancel():void {
78 | this.visible = false;
79 | this.cont.m_fader.visible = false;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/Gui/MyCellRenderer.as:
--------------------------------------------------------------------------------
1 | package Gui
2 | {
3 | import Game.Graphics.Resource;
4 | import fl.controls.listClasses.CellRenderer;
5 | import mx.core.BitmapAsset;
6 |
7 | public class MyCellRenderer extends CellRenderer
8 | {
9 | public function MyCellRenderer()
10 | {
11 | setStyle("upSkin", listboxBase());
12 | setStyle("overSkin", listboxRoll());
13 | setStyle("selectedOverSkin", listboxRoll());
14 | setStyle("downSkin", listboxClick());
15 | setStyle("selectedUpSkin", listboxClick());
16 | setStyle("selectedDownSkin", listboxClick());
17 | }
18 |
19 | public static function listboxBase():BitmapAsset {
20 | var bm:BitmapAsset = new Resource.cGuiListboxBase();
21 | bm.smoothing = true;
22 | return bm;
23 | }
24 |
25 | public static function listboxRoll():BitmapAsset {
26 | var bm:BitmapAsset = new Resource.cGuiListboxRoll();
27 | bm.smoothing = true;
28 | return bm;
29 | }
30 |
31 | public static function listboxClick():BitmapAsset {
32 | var bm:BitmapAsset = new Resource.cGuiListboxClick();
33 | bm.smoothing = true;
34 | return bm;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Gui/MyWideCellRenderer.as:
--------------------------------------------------------------------------------
1 | package Gui
2 | {
3 | import Game.Graphics.Resource;
4 | import fl.controls.listClasses.CellRenderer;
5 | import mx.core.BitmapAsset;
6 |
7 | public class MyWideCellRenderer extends CellRenderer
8 | {
9 | public function MyWideCellRenderer()
10 | {
11 | setStyle("upSkin", listboxBase());
12 | setStyle("overSkin", listboxRoll());
13 | setStyle("selectedOverSkin", listboxRoll());
14 | setStyle("downSkin", listboxClick());
15 | setStyle("selectedUpSkin", listboxClick());
16 | setStyle("selectedDownSkin", listboxClick());
17 | }
18 |
19 | public static function listboxBase():BitmapAsset {
20 | var bm:BitmapAsset = new Resource.cGuiListboxWideBase();
21 | bm.smoothing = true;
22 | return bm;
23 | }
24 |
25 | public static function listboxRoll():BitmapAsset {
26 | var bm:BitmapAsset = new Resource.cGuiListboxWideRoll();
27 | bm.smoothing = true;
28 | return bm;
29 | }
30 |
31 | public static function listboxClick():BitmapAsset {
32 | var bm:BitmapAsset = new Resource.cGuiListboxWideClick();
33 | bm.smoothing = true;
34 | return bm;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Gui/PostReplayWindow.ts:
--------------------------------------------------------------------------------
1 | import { Text, TextStyle } from 'pixi.js'
2 | import { ControllerGame, ControllerGameGlobals, GuiButton, GuiWindow, Main } from "../imports";
3 |
4 | export class PostReplayWindow extends GuiWindow
5 | {
6 | private cont:ControllerGame;
7 | private m_header:Text;
8 | private m_viewReplayButton:GuiButton;
9 | private m_loadReplayButton:GuiButton;
10 | private m_stopButton:GuiButton;
11 | private m_rateButton:GuiButton;
12 | private m_mainMenuButton:GuiButton;
13 | private m_closeButton:GuiButton;
14 |
15 | constructor(contr:ControllerGame)
16 | {
17 | super(323, 130, 154, (ControllerGameGlobals.curReplayID == "" ? 210 : 240));
18 | this.cont = contr;
19 |
20 | this.m_header = new Text('');
21 | this.m_header.text = "End of Replay";
22 | this.m_header.x = 27 + 50;
23 | this.m_header.y = 20;
24 | this.m_header.anchor.set(0.5, 0);
25 | var format = new TextStyle();
26 | format.align = 'center';
27 | format.fontFamily = Main.GLOBAL_FONT;
28 | format.fontSize = 14;
29 | format.fill = 0x242930;
30 | this.m_header.style = format;
31 | this.addChild(this.m_header);
32 |
33 | this.m_viewReplayButton = new GuiButton("View Again!", 22, 45, 110, 35, this.viewReplayButton.bind(this), GuiButton.PURPLE);
34 | this.addChild(this.m_viewReplayButton);
35 | this.m_loadReplayButton = new GuiButton("Load Replay", 22, 75, 110, 35, this.loadReplayButton.bind(this), GuiButton.PURPLE);
36 | this.addChild(this.m_loadReplayButton);
37 | this.m_stopButton = new GuiButton("Stop Replay", 22, 105, 110, 35, this.rewindButton.bind(this), GuiButton.PURPLE);
38 | this.addChild(this.m_stopButton);
39 | if (ControllerGameGlobals.curReplayID != "") {
40 | this.m_rateButton = new GuiButton("Rate this Replay", 22, 135, 110, 35, this.rateButton.bind(this), GuiButton.PURPLE);
41 | this.addChild(this.m_rateButton);
42 | }
43 | this.m_mainMenuButton = new GuiButton("Main Menu", 22, (ControllerGameGlobals.curReplayID == "" ? 135 : 165), 110, 35, this.mainMenuButton.bind(this), GuiButton.PURPLE);
44 | this.addChild(this.m_mainMenuButton);
45 | this.m_closeButton = new GuiButton("Close", 22, (ControllerGameGlobals.curReplayID == "" ? 165 : 195), 110, 35, this.cancelButton.bind(this), GuiButton.PURPLE);
46 | this.addChild(this.m_closeButton);
47 | }
48 |
49 | private rateButton():void {
50 | this.ShowFader();
51 | this.cont.rateReplayButton();
52 | }
53 |
54 | private viewReplayButton():void {
55 | this.visible = false;
56 | this.cont.m_fader.visible = false;
57 | this.cont.resetButton();
58 | }
59 |
60 | private loadReplayButton():void {
61 | this.visible = false;
62 | this.cont.m_fader.visible = false;
63 | this.cont.loadReplayButton();
64 | }
65 |
66 | private rewindButton():void {
67 | this.visible = false;
68 | this.cont.m_fader.visible = false;
69 | this.cont.rewindButton();
70 | }
71 |
72 | private mainMenuButton():void {
73 | this.visible = false;
74 | this.cont.m_fader.visible = false;
75 | this.cont.newButton();
76 | }
77 |
78 | private cancelButton():void {
79 | this.visible = false;
80 | this.cont.m_fader.visible = false;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/Gui/TermsWindow.as:
--------------------------------------------------------------------------------
1 | package Gui
2 | {
3 | import Game.*;
4 | import General.LSOManager;
5 |
6 | import fl.controls.*;
7 | import fl.events.*;
8 |
9 | import flash.events.*;
10 | import flash.text.*;
11 |
12 | public class TermsWindow extends GuiWindow
13 | {
14 | private var parentWindow:GuiWindow;
15 | private var loginFunction:Function;
16 |
17 | public var header:TextField;
18 | public var termsLink:TextField;
19 | public var okButton:Button;
20 | public var cancelButton:Button;
21 |
22 | public function TermsWindow(p:GuiWindow, l:Function) {
23 | parentWindow = p;
24 | loginFunction = l;
25 |
26 | var format:TextFormat = new TextFormat();
27 | format.font = Main.GLOBAL_FONT;
28 | format.color = 0x242930;
29 | format.align = TextFormatAlign.CENTER;
30 | header = new TextField();
31 | header.text = "Note that by clicking OK\nyou acknowledge that\nyou have read and\nagree to the";
32 | header.x = 8;
33 | header.y = 15;
34 | header.width = 140;
35 | header.setTextFormat(format);
36 | header.selectable = false;
37 | addChild(header);
38 |
39 | format = new TextFormat();
40 | format.font = Main.GLOBAL_FONT;
41 | format.color = 0x0000FF;
42 | format.align = TextFormatAlign.CENTER;
43 | termsLink = new TextField();
44 | termsLink.text = "IncrediBots\nTERMS OF USE.";
45 | termsLink.x = 27;
46 | termsLink.y = 75;
47 | termsLink.width = 100;
48 | termsLink.setTextFormat(format);
49 | termsLink.selectable = false;
50 | termsLink.addEventListener(MouseEvent.CLICK, termsButton, false, 0, true);
51 | addChild(termsLink);
52 |
53 | okButton = new GuiButton("OK", 27, 112, 100, 35, okButtonPressed, GuiButton.PURPLE);
54 | addChild(okButton);
55 | cancelButton = new GuiButton("Cancel", 27, 142, 100, 35, cancelButtonPressed, GuiButton.PURPLE);
56 | addChild(cancelButton);
57 |
58 | super(0, 0, 154, 185);
59 | }
60 |
61 | private function okButtonPressed(e:MouseEvent):void {
62 | LSOManager.SetTermsRead();
63 | visible = false;
64 | loginFunction(e);
65 | }
66 |
67 | private function cancelButtonPressed(e:MouseEvent):void {
68 | visible = false;
69 | parentWindow.HideFader();
70 | }
71 |
72 | private function termsButton(e:MouseEvent):void {
73 | Main.BrowserRedirect("http://www.incredifriends.com/", true);
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/src/Parts/FixedJoint.ts:
--------------------------------------------------------------------------------
1 | import { b2Body, b2World } from "../Box2D";
2 | import { JointPart, ShapePart, Util } from "../imports";
3 |
4 | export class FixedJoint extends JointPart {
5 | constructor(p1: ShapePart, p2: ShapePart, x: number, y: number) {
6 | super(p1, p2);
7 | this.anchorX = x;
8 | this.anchorY = y;
9 | this.type = "FixedJoint";
10 | }
11 |
12 | public Init(world: b2World, body: b2Body = null): void {
13 | if (this.isInitted || !this.part1.isInitted || !this.part2.isInitted) return;
14 | super.Init(world);
15 | }
16 |
17 | public MakeCopy(p1: ShapePart, p2: ShapePart): JointPart {
18 | return new FixedJoint(p1, p2, this.anchorX, this.anchorY);
19 | }
20 |
21 | public Update(world: b2World): void {}
22 |
23 | public InsideShape(xVal: number, yVal: number, scale: number): boolean {
24 | return Util.GetDist(this.anchorX, this.anchorY, xVal, yVal) < (0.18 * 30) / scale;
25 | }
26 |
27 | public KeyInput(key: number, up: boolean, replay: boolean): void {
28 | // do nothing
29 | }
30 |
31 | public ToString(): string {
32 | return "FixedJoint: " + super.ToString();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Parts/JointPart.ts:
--------------------------------------------------------------------------------
1 | import { b2Joint, b2World } from "../Box2D";
2 | import { IllegalOperationError, Part, ShapePart, Util } from "../imports";
3 |
4 | export class JointPart extends Part {
5 | public part1: ShapePart;
6 | public part2: ShapePart;
7 | public part1Index: number = -1;
8 | public part2Index: number = -1;
9 | public anchorX: number;
10 | public anchorY: number;
11 | public m_joint: b2Joint;
12 |
13 | constructor(p1: ShapePart, p2: ShapePart) {
14 | super();
15 | this.part1 = p1;
16 | this.part2 = p2;
17 | this.part1.AddJoint(this);
18 | this.part2.AddJoint(this);
19 | this.anchorX = 0;
20 | this.anchorY = 0;
21 | }
22 |
23 | public GetJoint(): b2Joint {
24 | return this.m_joint;
25 | }
26 |
27 | public GetOtherPart(p: ShapePart): ShapePart | null {
28 | if (p == this.part1) return this.part2;
29 | if (p == this.part2) return this.part1;
30 | return null;
31 | }
32 |
33 | public UnInit(world: b2World): void {
34 | if (!this.isInitted) return;
35 | super.UnInit(world);
36 | this.m_joint = null;
37 | }
38 |
39 | public Move(xVal: number, yVal: number): void {
40 | this.anchorX = xVal;
41 | this.anchorY = yVal;
42 | }
43 |
44 | public RotateAround(xVal: number, yVal: number, curAngle: number): void {
45 | var dist: number = Util.GetDist(this.anchorX, this.anchorY, xVal, yVal);
46 | var absoluteAngle: number = this.rotateAngle + curAngle;
47 | this.Move(xVal + dist * Math.cos(absoluteAngle), yVal + dist * Math.sin(absoluteAngle));
48 | }
49 |
50 | public MakeCopy(p1: ShapePart, p2: ShapePart): JointPart {
51 | throw new IllegalOperationError("abstract JointPart.MakeCopy() called");
52 | }
53 |
54 | public GetAttachedParts(partList: Array = null): Array {
55 | if (partList == null) partList = new Array();
56 | partList.push(this);
57 |
58 | var part1There: boolean = false;
59 | var part2There: boolean = false;
60 | for (var i: number = 0; i < partList.length; i++) {
61 | if (this.part1 == partList[i]) part1There = true;
62 | if (this.part2 == partList[i]) part2There = true;
63 | }
64 | if (!part1There) partList.concat(this.part1.GetAttachedParts(partList));
65 | if (!part2There) partList.concat(this.part2.GetAttachedParts(partList));
66 |
67 | return partList;
68 | }
69 |
70 | public IntersectsBox(boxX: number, boxY: number, boxW: number, boxH: number): boolean {
71 | return this.anchorX >= boxX && this.anchorX <= boxX + boxW && this.anchorY >= boxY && this.anchorY <= boxY + boxH;
72 | }
73 |
74 | public PrepareForResizing(): void {}
75 |
76 | public ToString(): string {
77 | return "anchorX=" + this.anchorX + ", " + "anchorY=" + this.anchorY + ", " + super.ToString();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/Parts/Part.ts:
--------------------------------------------------------------------------------
1 | import { b2Body, b2World } from "../Box2D";
2 |
3 | export class IllegalOperationError extends Error {}
4 |
5 | export class Part {
6 | public isEnabled: boolean = true;
7 | public isStatic: boolean = false;
8 | public isEditable: boolean = true;
9 | public isInitted: boolean = false;
10 | public checkedCollisionGroup: boolean = false;
11 | public drawAnyway: boolean = true;
12 | public isSandbox: boolean = false;
13 | public type: string;
14 |
15 | public rotateAngle: number;
16 | public rotateOrientation: number;
17 | public dragXOff: number;
18 | public dragYOff: number;
19 |
20 | protected IsEnabled(p: Part, i: number, a: Array): boolean {
21 | return this.isEnabled;
22 | }
23 |
24 | public Init(world: b2World, body: b2Body = null): void {
25 | this.isInitted = true;
26 | }
27 |
28 | public UnInit(world: b2World): void {
29 | this.isInitted = false;
30 | }
31 |
32 | public InsideShape(xVal: number, yVal: number, scale: number): boolean {
33 | throw new IllegalOperationError("abstract Part.InsideShape() called");
34 | }
35 |
36 | public Move(xVal: number, yVal: number): void {
37 | throw new IllegalOperationError("abstract Part.Move() called");
38 | }
39 |
40 | public RotateAround(xVal: number, yVal: number, angle: number): void {
41 | throw new IllegalOperationError("abstract Part.RotateAround() called");
42 | }
43 |
44 | public KeyInput(key: number, up: boolean, replay: boolean): void {
45 | throw new IllegalOperationError("abstract Part.KeyInput() called");
46 | }
47 |
48 | public Update(world: b2World): void {
49 | throw new IllegalOperationError("abstract Part.Update() called");
50 | }
51 |
52 | public GetAttachedParts(partList: Array = null): Array {
53 | throw new IllegalOperationError("abstract Part.GetAttachedParts() called");
54 | }
55 |
56 | public IntersectsBox(boxX: number, boxY: number, boxW: number, boxH: number): boolean {
57 | throw new IllegalOperationError("abstract Part.IntersectsBox() called");
58 | }
59 |
60 | public PrepareForResizing(): void {
61 | throw new IllegalOperationError("abstract Part.PrepareForResizing() called");
62 | }
63 |
64 | public ToString(): string {
65 | return (
66 | "isEnabled=" +
67 | this.isEnabled +
68 | ", isStatic=" +
69 | this.isStatic +
70 | ", isEditable=" +
71 | this.isEditable +
72 | ", isInitted=" +
73 | this.isInitted +
74 | ", type=" +
75 | this.type
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Application } from 'pixi.js';
2 |
3 | import { Main, Resource } from './imports'
4 |
5 |
6 | async function main() {
7 | await Resource.load()
8 |
9 | const renderer = new Application({
10 | antialias: true,
11 | width: 800,
12 | height: 600
13 | });
14 | const main = new Main(renderer)
15 |
16 | const gameWrapper = document.getElementById('game_wrapper')
17 | if (gameWrapper) {
18 | gameWrapper.innerHTML = ''
19 | gameWrapper.appendChild(renderer.view)
20 | }
21 | }
22 |
23 | main()
24 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["es2020", "dom"],
4 | "module": "commonjs",
5 | "target": "es2020",
6 |
7 | "strict": true,
8 | "esModuleInterop": true,
9 | "skipLibCheck": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "moduleResolution": "node"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------