├── Backgrounds └── BG_43.jpg ├── Char.as ├── For King.txt ├── Levels.as ├── Main.as ├── README.md └── src ├── Box2D └── Collision │ ├── ClipVertex.as │ ├── Features.as │ ├── b2AABB.as │ ├── b2Bound.as │ ├── b2BoundValues.as │ ├── b2BufferedPair.as │ ├── b2ContactID.as │ ├── b2ContactPoint.as │ ├── b2Manifold.as │ ├── b2ManifoldPoint.as │ ├── b2OBB.as │ ├── b2PairCallback.as │ ├── b2Point.as │ └── b2Proxy.as └── com └── .DS_Store /Backgrounds/BG_43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AD1337/ForKingGame/95fc6b9dd0b6e782a01e047e041bff62e175766f/Backgrounds/BG_43.jpg -------------------------------------------------------------------------------- /Char.as: -------------------------------------------------------------------------------- 1 | if ( (charVel.x < .5 && charVel.x >=0) || charVel.x > -.5 && charVel.x <=0) 2 | { 3 | IsWalking = false; 4 | } 5 | 6 | //ANIMATION 7 | 8 | if (intervalCount < 3) 9 | { 10 | intervalCount++; 11 | } 12 | else 13 | { 14 | if (char.userData.currentFrame < char.userData.totalFrames && char.userData.currentFrame > 1) 15 | { 16 | char.userData.nextFrame(); 17 | if (IsWalking == false) 18 | { 19 | char.userData.gotoAndStop(1); 20 | } 21 | } 22 | else 23 | { 24 | if (IsWalking == true) 25 | { 26 | char.userData.gotoAndStop(2); 27 | } 28 | else 29 | { 30 | char.userData.gotoAndStop(1); 31 | } 32 | } 33 | intervalCount = 0; 34 | } 35 | 36 | //PLAYER INPUT & MOVEMENT 37 | 38 | charVel = char.body.GetLinearVelocity(); 39 | if ( (key[Keyboard.RIGHT] || key[Keyboard.D]) && PlayerMove == true) 40 | { 41 | if (charVel.x < 8) 42 | { 43 | charVel.x += 0.5; 44 | char.body.SetLinearVelocity(charVel); 45 | char.userData.scaleX = 1; 46 | IsWalking = true; 47 | } 48 | } 49 | if ( (key[Keyboard.LEFT] || key[Keyboard.A]) && PlayerMove == true) 50 | { 51 | if (charVel.x > -8) 52 | { 53 | charVel.x -=0.5; 54 | char.body.SetLinearVelocity(charVel); 55 | char.userData.scaleX = -1; 56 | IsWalking = true; 57 | } 58 | } 59 | 60 | //JUMP 61 | 62 | if ( (key[Keyboard.UP] || key[Keyboard.W]) && grounded == true && PlayerMove == true) 63 | { 64 | charVel.y = -8.7; 65 | char.body.SetLinearVelocity(charVel); 66 | /*grounded = false;*/ 67 | } 68 | 69 | // SCREEN TRANSITION 70 | 71 | // X 72 | 73 | /*Left*/ 74 | 75 | if (char.x < .1) 76 | { 77 | DestroyLevelAny(); 78 | HideBG(); 79 | if (CurrentLevel != 116) 80 | { 81 | CurrentLevel -= 1; 82 | } 83 | else 84 | { 85 | CurrentLevel = 107; 86 | } 87 | ShowBG(); 88 | this['CreateLevel'+CurrentLevel](); 89 | txtLvl.text = String(CurrentLevel); 90 | 91 | MoveTo = 23.2; 92 | MoveChar(); 93 | } 94 | 95 | /*Right*/ 96 | 97 | if (char.x > 23.3) 98 | { 99 | DestroyLevelAny(); 100 | HideBG(); 101 | if (CurrentLevel != 107) 102 | { 103 | CurrentLevel += 1; 104 | } 105 | else 106 | { 107 | CurrentLevel = 107; 108 | } 109 | ShowBG(); 110 | this['CreateLevel'+CurrentLevel](); 111 | txtLvl.text = String(CurrentLevel); 112 | 113 | MoveTo = .2; 114 | MoveChar(); 115 | } 116 | 117 | // Y 118 | 119 | /*Top*/ 120 | 121 | if (char.y < 0.1) 122 | { 123 | DestroyLevelAny(); 124 | HideBG(); 125 | CurrentLevel += 100; 126 | ShowBG(); 127 | this['CreateLevel'+CurrentLevel](); 128 | txtLvl.text = String(CurrentLevel); 129 | 130 | MoveTo = 13.9; 131 | MoveCharY(); 132 | } 133 | 134 | /*Bottom*/ 135 | 136 | if (char.y > 14) 137 | { 138 | DestroyLevelAny(); 139 | HideBG(); 140 | CurrentLevel -= 100; 141 | ShowBG(); 142 | this['CreateLevel'+CurrentLevel](); 143 | txtLvl.text = String(CurrentLevel); 144 | 145 | MoveTo = 0.2; 146 | MoveCharY(); 147 | } -------------------------------------------------------------------------------- /For King.txt: -------------------------------------------------------------------------------- 1 | -tree branches 2 | -family branches 3 | -dna cloning 4 | -flower cloning, polen 5 | 6 | -For King Wind 7 | -For King Pride 8 | -For King Greed <- 9 | -For King Sin 10 | -For King Siddharta 11 | 12 | -For King Ego 13 | -For Kings 14 | -ForKing 15 | 16 | -things that get away from you when you get closer to them. 17 | 18 | 19 | VISUALS 20 | -blurred background 21 | -windy (cloud like speech balloon for mayas) cursor, pointing to the cursor target pixel. 22 | -intro: king starts in the top of a castle, crown on his head. The wind blows it away and it falls down (physics) all the way down the steps. The player takes control and goes on to get the crown. 23 | 24 | MECHANICS 25 | -move the king by using the mouse to control wind. 26 | -move with <-, -> and A D. 27 | 28 | -you can prototype this game with what you have so far. Drag objects to simulate wind or something. Is this really the game you want? 29 | -for king's sake, make a fucking mockup. 30 | -on your path to have it all (even the crown), you end up losing it all. But in losing it all, you gain it all. Then you have not just a cape, a scepter and a crown: you have nothing, and by having nothing you have everything (the trees, the leaves, the wind, the water). 31 | 32 | WORDS 33 | -"On the King's path to have all, he has lost all." 34 | -"But in losing all, he has gained all." 35 | 36 | PITCH 37 | 38 | -A relaxing platformer with physics puzzles. 39 | -A relaxing puzzle platformer with physics. 40 | -2D Puzzle platformer with physics. 41 | -2D platformer about a king's journey. 42 | -You are a king in search for your lost crown. 43 | -A king in search for his lost crown. 44 | 45 | -Platformer with physics puzzles, relaxing atmosphere and existentialist/philosophical message. 46 | 47 | -Sensorial, it's about the king leaving his ivory tower and experience things: touch, sound, visuals, anger, despair, ambition, joy, pity, compassion, lonelyness, and losing his pride in favor of all these. 48 | -A game about a king that loses his crown and goes on a journey to recover it. But the world turns out to be far more dangerous than the safety of his castle, and he ends up losing everything else: his scepter, his coat, his shoes. Though he loses all material possessions, he learns a valuable lesson. 49 | -Unlike other games, it's not about gaining things and reaching the castle in the end. You leave the castle right at the beginning, and lose everything in your journey. 50 | -It's not about becoming a king, it's about abandoning everything and, in doing so, gaining it all. 51 | 52 | -the game comes to a point where you can't push things anymore, you are weak. Then you can't jump anymore, you are tired. You can only walk, you are powerless. 53 | -Or there is an obstacle that you just can't go through, an obstacle too heavy for you to push. 54 | 55 | ----------------- TO DO ---------------- 56 | 57 | MECHANICS 58 | -Stepping sounds (activated when keys are pressed, stops when they aren't). 59 | -Walking animation (and others? preferably this is just hopping around in y axis). 60 | X-falling down when jumping 61 | -frame transition right to left, left to right. 62 | -reset button 63 | -respawning on death 64 | -FEET to avoid wall collision and wall walking and jumping. 65 | 66 | ART 67 | -Backgrounds. 68 | -Use refs for value range, depth, color scheme, elements. 69 | -You are in the 2nd plane, not in the first. Could be some trees in the first or moving animals, see refs folder. 70 | 71 | BACKGROUNDS 72 | -Forest 73 | -Snow 74 | 75 | ITEMS 76 | -Crown (loses at castle) 77 | -Scepter (loses at forest) 78 | -Boots (loses at mountain) 79 | -Cape (loses at snow) 80 | -Underwear? (loses at shadow kingdom) 81 | 82 | LEVELS 83 | -Level designs and execution. 84 | 85 | LEVEL IDEAS 86 | -"Basic Platforming" 87 | -"Domino": domino blocks, you hit one and all others fall in chain, letting you reach the end. 88 | -"Be quick": falling block 89 | -"In the way": rock in the way 90 | -"Mind the gap": hole must be filled with a wagon wheel so you can pass. 91 | -"Bridge": push the lever to bring down the elevated bridge so you can go right. 92 | -"Freezing Child" give coat (press up). Once you give it, you can take the coat back by pressing down. If you leave the kid without it, he dies.] 93 | -"Catapult Yourself" 94 | -"Catapult to Destroy" 95 | -"Juggle Walking" above a circle to avoid spikes below, or to be higher up and be able to jump on other side 96 | -"Wall jumping" 97 | -"Slipery" reduce friction of some platforms. 98 | -"Gravity" fucked up gravity 99 | -"Wind" wind left to right, right to left. 100 | -"Begging" a level in which you can beg to have your scepter back, but the guy just shakes his head "no no no". Nothing you can do. First you order him to return it, then you beg. He says no both times, and there's nothing you can do. 101 | -"Twin levels" -> things are being thrown from the right, you find out there's a catapult there when you go on the next screen. 102 | 103 | -"The Old Man" 104 | -"The Diseased Man" 105 | -"The Decaying Corpse" 106 | -"The Ascetic" (Monk) ----> all these are in the palace still 107 | 108 | -"The Indulgent" 109 | -"The Self-Mortificator" 110 | -"fall and respawn at top" 111 | -"You HAVE to turn back, then you go somewhere different than where you came from. Maybe you see the crown, but it's unreachable. 112 | 113 | LEVEL LIST 114 | 1) Crown Falls 115 | 2) Brick in the way 116 | 3) Elevated Bridge 117 | 4) Mind the Gap 118 | 119 | 5) Harder Mind the Gap 120 | 6) Jump Over Lever 121 | 7) Wheel Jump Over Spikes (dont need to juggle walk) 122 | 8) Harder Wheel Jump Over Spikes (need to juggle walk) 123 | 124 | 9) Rolling Stone 125 | 10) 126 | 11) 127 | 12) Downhill (with stones rolling behind you) 128 | 129 | 13) Slippery 130 | 14) 131 | 15) 132 | 16) Cold Child 133 | 134 | 17) Descending 135 | 18) 136 | 19) 137 | 20) The Crown 138 | 139 | One above the sky that, when you jump from the level below, you can quickly (because you fall) see a cloud in the shape of a crown. 140 | 141 | NEW LIST 142 | 143 | CASTLE 144 | 145 | 901) Crown Falls 146 | 801) Fall 147 | 701) Bridge 148 | 702) Brick 149 | 703) You have to fall 150 | 603) Fall 151 | 152 | PLAINS 153 | 154 | 502) Blocked 155 | 503) Ground 156 | 504) Gap 157 | 158 | FOREST 159 | 160 | 505) Simple Jump 161 | 506) Harder Gap 162 | 507) Keep Up or you can't reach it - jump on wheel while it's moving or it falls too low. 163 | 164 | DESERT 165 | 166 | 508) Introduction to rock piles 167 | 509) Climbing 168 | 169 | MOUNTAINS 170 | 171 | 609) More Climbing 172 | 709) Climbing with falling rocks. 173 | 174 | SNOW 175 | 176 | SHADOW KINGDOM 177 | 178 | ENLIGHTENMENT 179 | 180 | THEMES 181 | -Castle Platforming, Levers 182 | -Forest Pushing 183 | -Mountain Rolling Stones, Wind, Moving Platforms 184 | -Snow Slippery, 185 | -Shadow K. Catapults 186 | 187 | IDEAS 188 | -take seeds that fall from sky and plant trees, flowers. Walk on its branches or climb it if it grows in a direction. 189 | -make bonfire 190 | -logs float on water, you otherwise sink. Can I even get water physics working? 191 | -sometimes there are 2 paths. You can finish the game without doing a certain level, they are the most unimportant ones. 192 | -15-20 minutes of gameplay total. 193 | -the visuals descend into surrealism: castle, forest, snow, shadow kingdom. 194 | -a different ending depending on a few choices. 195 | -BUILD MODE: use the mouse to drag objects, click to switch object, you can build stuff. 196 | 197 | ENDINGS 198 | -you saved the child, now you live with the woman. 199 | -you let the child to die and asked for forgiveness, you live with the woman and the child is dead, there's a grave. 200 | -you let the child die and didn't apologize: you are alone. 201 | -you took the crown: you are wearing it alone. 202 | -kingdom being rebuilt, you are the king. 203 | -If you turn back when you reach the crown screen, you gain enlightement. Instead of going back 1 level, you go somewhere else. 204 | 205 | ACTIONS 206 | -D Demand 207 | -B Beg 208 | -A Apologize 209 | -F Forgive 210 | -L Love 211 | -B Be a monster 212 | -B Be evil (these just appear if you kill the child and have no other effect) 213 | -B Be mean 214 | -B Be Mad 215 | -B Be Horrible 216 | 217 | -UP Give Coat 218 | -DOWN Take Coat 219 | -UP Take Crown 220 | -DOWN Throw Crown 221 | 222 | EYECANDY 223 | -butterflies and birds 224 | -bunnies 225 | -color overlay for each area: forest is yellow, shadow kingdom is red. 226 | 227 | SOUNDS 228 | -jump 229 | -fall from jump (trigger at jump, next contact triggers the fall sound, then it's off until you jump again) 230 | -steps 231 | -background 232 | -things should have sounds too. 233 | -falling sounds will be possible based on the "grounded" boolean. 234 | 235 | OVERALL 236 | -Levels 237 | -Visuals 238 | -Sounds 239 | -Music 240 | 241 | IMMEDIATE 242 | -I might actually have to make the first platforms start at -1 x so you dont get the problem I've been having with the level not being destroyed before char is moved... 243 | 244 | CREDITS 245 | -Credits screen: falling leaves, moonlight, the king is standing under the tree, looking out a vast landscape, perhaps a sunset. 246 | 247 | -Environment Art: Lucas Molina (name stays, the role changes) 248 | -Level Design: Lucas Molina 249 | -Sound Design: Lucas Molina 250 | -Story: Lucas Molina and Luiza Wolff 251 | 252 | -Character Concepts: Luiza Wolff 253 | -Music: Morvan 254 | 255 | -Physics Engine: QuickBox2D 256 | -Software: FlashDevelop 257 | 258 | -On the king's journey to have it all, he has lost everything. 259 | -But in losing everything, he has gained it all. 260 | -Thank you for playing. -------------------------------------------------------------------------------- /Levels.as: -------------------------------------------------------------------------------- 1 | /*DEFAULT STYLES*/ 2 | 3 | function PlatformDefault():void 4 | { 5 | sim.setDefault({lineColor:0x493957, fillColor:0x493957, height:0.5, density:0, lineAlpha:0, fillAlpha:0}); 6 | } 7 | 8 | function ObjectsDefault():void 9 | { 10 | sim.setDefault({lineColor:0x2870B5, fillColor:0x2870B5}); 11 | } 12 | 13 | function GrassDefault():void 14 | { 15 | sim.setDefault({lineColor:0x66FF66, fillColor:0x66FF66, lineAlpha:0, fillAlpha:0, density:0}); 16 | } 17 | 18 | function PatchDefault():void 19 | { 20 | sim.setDefault({lineColor:0x000000, fillColor:0x000000, width:1, height:1, density:0, isSleeping:true}); 21 | } 22 | 23 | function CloudDefault():void 24 | { 25 | sim.setDefault({lineColor:0x000000, fillColor:0x000000, width:1, height:1, density:0, isSleeping:true}); 26 | } 27 | 28 | function getRandom(min:Number, max:Number):Number { 29 | return min + (Math.random() * (max - min)); 30 | } 31 | 32 | /*CREATE LEVEL*/ 33 | 34 | //LEVEL 901 35 | 36 | var CrownObj:QuickObject; 37 | 38 | function CreateLevel901():void 39 | { 40 | PlatformDefault(); 41 | 42 | LVL901Parts.push(sim.addBox({x:9, y:7, width:7})); 43 | 44 | LVL901Parts.push(sim.addBox({x:5.3, y:6, width:.1, height:6})); 45 | 46 | //LVL901Parts.push(sim.addBox({x:21, y:1, width:2, height:1, groupIndex:-1, skin:Cloud1})); 47 | 48 | var cloud0:QuickObject = sim.addBox({x:11, y:1, width:2, height:1, groupIndex:-1, skin:Cloud1, density:.1}); 49 | LVL901Parts.push(cloud0); 50 | 51 | var cloud1:QuickObject = sim.addBox({x:7, y:11, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:.1}); 52 | LVL901Parts.push(cloud1); 53 | 54 | //nogravity = cloud1; 55 | nogravityArray[0] = cloud0; 56 | nogravityArray[1] = cloud1; 57 | nogravityObjs = 2; 58 | 59 | ObjectsDefault(); 60 | 61 | if (PlayCinematic == true) 62 | { 63 | CrownObj = sim.addBox({x:13.1, y:5.2, width:.8, height:.4, skin:Crown, scaleSkin:false}); 64 | LVL901Parts.push(CrownObj); 65 | 66 | //LVL901Parts.push(sim.addBox({x:13.1, y:5.2, width:.8, height:.4, skin:Crown, scaleSkin:false})); 67 | 68 | SecondCountdown.start(); 69 | 70 | stage.addChildAt(TopBar,1); 71 | TopBar.x = 0; 72 | TopBar.y = 0; 73 | 74 | stage.addChildAt(BotBar,1); 75 | BotBar.x = 0; 76 | BotBar.y = 340; 77 | 78 | stage.addChildAt(LeafObj,1); 79 | LeafObj.x = -60; 80 | LeafObj.y = 200; 81 | } 82 | 83 | } 84 | 85 | var TopBar:BlackBar = new BlackBar(); 86 | var BotBar:BlackBar = new BlackBar(); 87 | 88 | var LeafObj:Leaf2 = new Leaf2(); 89 | 90 | var GoLeaf:Boolean = false; 91 | 92 | var FirstCountdown:Timer = new Timer(7000, 1); 93 | FirstCountdown.addEventListener(TimerEvent.TIMER, FunFirstCountdown); 94 | FirstCountdown.start(); 95 | function FunFirstCountdown(e:TimerEvent):void 96 | { 97 | GoLeaf = true; 98 | } 99 | 100 | var SecondCountdown:Timer = new Timer(10000, 1); 101 | SecondCountdown.addEventListener(TimerEvent.TIMER, FunSecondCountdown); 102 | function FunSecondCountdown(e:TimerEvent):void 103 | { 104 | CrownObj.body.SetLinearVelocity(new b2Vec2(5, 1)); 105 | ThirdCountdown.start(); 106 | } 107 | 108 | var ThirdCountdown:Timer = new Timer(2000, 1); 109 | ThirdCountdown.addEventListener(TimerEvent.TIMER, FunThirdCountdown); 110 | function FunThirdCountdown(e:TimerEvent):void 111 | { 112 | trace("gogogogoogo"); 113 | var tweYearFade:Tween = new Tween(TopBar, "y", Strong.easeOut, TopBar.y, -70, 1, true); 114 | var tweYear2Fade:Tween = new Tween(BotBar, "y", Strong.easeOut, BotBar.y, 410, 1, true); 115 | PlayerMove = true; 116 | 117 | PlayCinematic = false; 118 | 119 | stage.addChildAt(LeftKey, 1); 120 | LeftKey.x = 330; 121 | LeftKey.y = 130; 122 | 123 | stage.addChildAt(RightKey, 1); 124 | RightKey.x = 410; 125 | RightKey.y = 130; 126 | 127 | stage.addChildAt(UpKey, 1); 128 | UpKey.x = 370; 129 | UpKey.y = 80; 130 | 131 | var Key1Fade:Tween = new Tween(LeftKey, "alpha", Strong.easeIn, 0, 1, 1, true); 132 | var Key2Fade:Tween = new Tween(UpKey, "alpha", Strong.easeIn, 0, 1, 1, true); 133 | var Key3Fade:Tween = new Tween(RightKey, "alpha", Strong.easeIn, 0, 1, 1, true); 134 | 135 | } 136 | 137 | var LeftKey:LeftKeyAS = new LeftKeyAS(); 138 | var RightKey:RightKeyAS = new RightKeyAS(); 139 | var UpKey:UpKeyAS = new UpKeyAS(); 140 | 141 | var nogravityObjs; 142 | var nogravity:QuickObject; 143 | //var nogravityArray:Array = new Array[]; 144 | var nogravityArray:Array = []; 145 | 146 | function CreateLevel902():void 147 | { 148 | 149 | } 150 | 151 | function CreateLevel802():void 152 | { 153 | 154 | } 155 | 156 | //LEVEL 801 157 | 158 | function CreateLevel801():void 159 | { 160 | PlatformDefault(); 161 | 162 | var cloud1:QuickObject = sim.addBox({x:14, y:5, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:0}); 163 | LVL801Parts.push(cloud1); 164 | } 165 | 166 | //LEVEL 701 167 | /*bottom is 13.2*/ 168 | 169 | function CreateLevel701():void 170 | { 171 | PlatformDefault(); 172 | LVL701Parts.push(sim.addBox({x:12, y:10, width:24})); 173 | 174 | //LVL701Parts.push(sim.addBox({x:2, y:8, width:.1, height:5})); 175 | 176 | ObjectsDefault(); 177 | LVL701Parts.push(sim.addBox({width: 1, height: .6, x:2.6, y:8, density:100, skin:Brick, scaleSkin:true})); 178 | LVL701Parts.push(sim.addBox({width: 2.6, height: 2, x:4, y:9, density:100, skin:Brick, scaleSkin:true})); 179 | LVL701Parts.push(sim.addBox({width: 1, height: 1, x:4, y:8, density:100, skin:Brick, scaleSkin:true})); 180 | LVL701Parts.push(sim.addBox({width: 1.6, height: 1.2, x:3, y:9, density:100, skin:Brick, scaleSkin:true})); 181 | 182 | 183 | PlatformDefault(); 184 | 185 | LVL701Parts.push(sim.addBox({x:4, y:10, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:0})); 186 | 187 | 188 | var cloud1:QuickObject = sim.addBox({x:11, y:12, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:0}); 189 | LVL701Parts.push(cloud1); 190 | } 191 | 192 | //LEVEL 702 193 | 194 | function CreateLevel702():void 195 | { 196 | PlatformDefault(); 197 | LVL702Parts.push(sim.addBox({x:12, y:10, width:24})); 198 | 199 | 200 | ObjectsDefault(); 201 | LVL702Parts.push(sim.addBox({width: 1, height: .6, x:9, y:9, density:10, skin:Brick, scaleSkin:true})); 202 | 203 | PlatformDefault(); 204 | LVL702Parts.push(sim.addBox({x:17, y:11.5, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:0})); 205 | 206 | 207 | } 208 | 209 | //LEVEL 703 210 | 211 | function CreateLevel703():void 212 | { 213 | PlatformDefault(); 214 | LVL703Parts.push(sim.addBox({x:2, y:10, width:4})); 215 | 216 | LVL703Parts.push(sim.addBox({x:14, y:10, width:4})); 217 | 218 | LVL703Parts.push(sim.addBox({x:8, y:12.5, width:2, height:1, groupIndex:-1, skin:Cloud2, scaleSkin:false, density:0})); 219 | } 220 | 221 | //LEVEL 704 222 | 223 | function CreateLevel704():void 224 | { 225 | 226 | } 227 | 228 | //LEVEL 603 229 | 230 | function CreateLevel603():void 231 | { 232 | 233 | } 234 | 235 | function CreateLevel604():void 236 | { 237 | 238 | } 239 | 240 | function CreateLevel602():void 241 | { 242 | 243 | } 244 | 245 | //LEVEL 502 246 | 247 | function CreateLevel502():void 248 | { 249 | GrassDefault(); 250 | 251 | LVL502Parts.push(sim.addBox({x:3, y:6, width:6, height:.1})); 252 | 253 | LVL502Parts.push(sim.addBox({x:14, y:11, width:20, height:.1})); 254 | 255 | LVL502Parts.push(sim.addBox({x:6, y:10, width:.1, height:8})); 256 | 257 | LVL502Parts.push(sim.addBox({x:6, y:11.3, width:.1, height:.1, scaleSkin:false, skin:LightBush})); 258 | } 259 | 260 | //LEVEL 503 261 | 262 | function CreateLevel503():void 263 | { 264 | GrassDefault(); 265 | 266 | LVL503Parts.push(sim.addBox({x:12, y:11, width:24, height:.1, density:0})); 267 | 268 | PatchDefault(); 269 | 270 | LVL503Parts.push(sim.addBox({x:12, y:12, skin:GrassPatch1, scaleSkin:false})); 271 | 272 | } 273 | 274 | 275 | //LEVEL 504 276 | 277 | function CreateLevel504():void 278 | { 279 | GrassDefault(); 280 | 281 | LVL504Parts.push(sim.addBox({x:8, y:11, width:16, height:.1, density:0})); 282 | LVL504Parts.push(sim.addBox({x:17, y:12, width:2, height:.1, density:0})); 283 | LVL504Parts.push(sim.addBox({x:21, y:9, width:6, height:.1, density:0})); 284 | 285 | LVL504Parts.push(sim.addBox({x:18.05, y:10, width:.1, height:1.8, density:0})); 286 | 287 | 288 | ObjectsDefault(); 289 | LVL504Parts.push(sim.addCircle({radius:1, x:12, y:9, skin:Wheel3})); 290 | 291 | GrassDefault(); 292 | LVL504Parts.push(sim.addBox({x:11.5, y:11.2, width:.1, height:.1, scaleSkin:false, skin:LightBush})); 293 | 294 | 295 | } 296 | 297 | //LEVEL 505 298 | 299 | function CreateLevel505():void 300 | { 301 | GrassDefault(); 302 | 303 | LVL505Parts.push(sim.addBox({x:4, y:9, width:8, height:.1, density:0})); 304 | 305 | LVL505Parts.push(sim.addBox({x:11, y:10, width:6, height:.1, density:0})); 306 | 307 | LVL505Parts.push(sim.addBox({x:17, y:8, width:6, height:.1, density:0})); 308 | 309 | LVL505Parts.push(sim.addBox({x:22, y:7, width:4, height:.1, density:0})); 310 | 311 | LVL505Parts.push(sim.addBox({x:20, y:8.2, width:.1, height:.1, scaleSkin:false, skin:DarkBush})); 312 | } 313 | 314 | //LEVEL 506 315 | 316 | function CreateLevel506():void 317 | { 318 | GrassDefault(); 319 | 320 | LVL506Parts.push(sim.addBox({x:4.5, y:7, width:9, height:.1, density:0})); 321 | 322 | LVL506Parts.push(sim.addBox({x:11, y:13, width:22, height:.1, density:0})); 323 | 324 | LVL506Parts.push(sim.addBox({x:23, y:11, width:2, height:.1, density:0})); 325 | 326 | LVL506Parts.push(sim.addBox({x:22.1, y:13, width:.1, height:4, density:0})); 327 | 328 | LVL506Parts.push(sim.addBox({x:3, y:10, width:.1, height:6, density:0})); 329 | 330 | PlatformDefault(); 331 | 332 | LVL506Parts.push(sim.addBox({x:10, y:10.5, width:4, height:0.1, density:0})); 333 | 334 | LVL506Parts.push(sim.addBox({x:4, y:12, width:2, height:0.1, density:0})); 335 | 336 | ObjectsDefault(); 337 | 338 | LVL506Parts.push(sim.addCircle({radius:1, x:9, y:9, skin:Wheel3})); 339 | 340 | } 341 | 342 | //LEVEL 507 343 | 344 | function CreateLevel507():void 345 | { 346 | GrassDefault(); 347 | 348 | LVL507Parts.push(sim.addBox({x:3, y:11, width:6, height:.1, density:0})); 349 | 350 | LVL507Parts.push(sim.addBox({x:10, y:12, width:8, height:.1, density:0})); 351 | 352 | LVL507Parts.push(sim.addBox({x:15, y:13, width:2, height:.1, density:0})); 353 | 354 | LVL507Parts.push(sim.addBox({x:20, y:9, width:8, height:.1, density:0})); 355 | 356 | LVL507Parts.push(sim.addBox({x:16, y:11, width:.1, height:4, density:0})); 357 | 358 | ObjectsDefault(); 359 | 360 | LVL507Parts.push(sim.addCircle({radius:0.8, x:8, y:10.5, skin:Wheel3})); 361 | 362 | GrassDefault(); 363 | 364 | LVL507Parts.push(sim.addBox({x:8, y:12.2, width:.1, height:.1, scaleSkin:false, skin:DarkBush})); 365 | } 366 | 367 | function CreateLevel508():void 368 | { 369 | GrassDefault(); 370 | 371 | LVL508Parts.push(sim.addBox({x:11.5, y:9, width:24, height:.1})); 372 | 373 | LVL508Parts.push(sim.addBox({width:.1, height:1, x:13, y:8.5})); 374 | 375 | LVL508Parts.push(sim.addBox({width:.1, height:2, x:18, y:8.5})); 376 | 377 | ObjectsDefault(); 378 | 379 | LVL508Parts.push(sim.addBox({width:2, height:.8, x:13, y:7.8, density:5, skin:Rock1})); 380 | 381 | LVL508Parts.push(sim.addBox({width:2.5, height:1.5, x:18, y:7, density:5, skin:Rock1})); 382 | 383 | 384 | } 385 | 386 | function CreateLevel509():void 387 | { 388 | GrassDefault(); 389 | LVL509Parts.push(sim.addBox({x:3, y:9, width:6, height:.1})); 390 | 391 | LVL509Parts.push(sim.addBox({x:10, y:10, width:8, height:.1})); 392 | 393 | LVL509Parts.push(sim.addBox({x:19, y:11, width:10, height:.1})); 394 | 395 | 396 | LVL509Parts.push(sim.addBox({width:.1, height:.2, x:4, y:6.6})); 397 | 398 | LVL509Parts.push(sim.addBox({width:.1, height:1, x:12, y:5})); 399 | 400 | LVL509Parts.push(sim.addBox({width:.1, height:1, x:18, y:3})); 401 | 402 | ObjectsDefault(); 403 | 404 | LVL509Parts.push(sim.addBox({width:3, height:1.5, x:4, y:6, density:5, skin:Rock1})); 405 | 406 | LVL509Parts.push(sim.addBox({width:2.5, height:1, x:12, y:4, density:5, skin:Rock1})); 407 | 408 | LVL509Parts.push(sim.addBox({width:2, height:.5, x:18, y:2.3, density:5, skin:Rock1})); 409 | 410 | } 411 | 412 | function CreateLevel609():void 413 | { 414 | 415 | } 416 | 417 | function CreateLevel610():void 418 | { 419 | 420 | } 421 | 422 | function CreateLevel510():void 423 | { 424 | GrassDefault(); 425 | 426 | LVL510Parts.push(sim.addBox({x:2, y:11, width:4, height:.1})); 427 | LVL510Parts.push(sim.addBox({x:6, y:10, width:4, height:.1})); 428 | LVL510Parts.push(sim.addBox({x:10, y:9, width:4, height:.1})); 429 | LVL510Parts.push(sim.addBox({x:14, y:8, width:4, height:.1})); 430 | LVL510Parts.push(sim.addBox({x:14, y:8, width:4, height:.1})); 431 | LVL510Parts.push(sim.addBox({x:18, y:7, width:4, height:.1})); 432 | LVL510Parts.push(sim.addBox({x:22, y:6, width:4, height:.1})); 433 | 434 | LVL510Parts.push(sim.addBox({width:.1, height:2, x:4, y:4})); 435 | 436 | ObjectsDefault(); 437 | 438 | var rock:QuickObject = sim.addCircle({radius:1.5, x:21, y:3, density:100, skin:RollingRock1}); 439 | LVL510Parts.push(rock); 440 | rock.body.SetLinearVelocity(new b2Vec2(-10, 0)); 441 | 442 | LVL510Parts.push(sim.addBox({width:3, height:1, x:4, y:3, density:5, skin:Rock1})); 443 | } 444 | 445 | function CreateLevel511():void 446 | { 447 | GrassDefault(); 448 | 449 | LVL511Parts.push(sim.addBox({x:4, y:6, width:8, height:.1})); 450 | 451 | LVL511Parts.push(sim.addBox({x:14, y:11, width:12, height:.1})); 452 | 453 | LVL511Parts.push(sim.addBox({x:7.9, y:8.5, width:.1, height:5})); 454 | 455 | LVL511Parts.push(sim.addBox({x:22, y:12, width:4, height:.1})); 456 | 457 | 458 | LVL511Parts.push(sim.addBox({x:19.9, y:11.5, width:.1, height:1})); 459 | 460 | //LVL511Parts.push(sim.addBox({x:16, y:10.5, width:.1, height:1})); 461 | 462 | ObjectsDefault(); 463 | 464 | //LVL511Parts.push(sim.addBox({width:3, height:.5, x:16, y:10, density:3, skin:Rock1})); 465 | 466 | //LVL511Parts.push(sim.addBox({width:.4, height:.4, x:14.9, y:9, density:.5, skin:RollingRock1})); 467 | } 468 | 469 | function CreateLevel512():void 470 | { 471 | GrassDefault(); 472 | 473 | LVL512Parts.push(sim.addBox({x:3, y:12, width:6, height:.1})); 474 | LVL512Parts.push(sim.addBox({x:9, y:11, width:6, height:.1})); 475 | LVL512Parts.push(sim.addBox({x:15, y:10, width:6, height:.1})); 476 | LVL512Parts.push(sim.addBox({x:21, y:9, width:6, height:.1})); 477 | 478 | ObjectsDefault(); 479 | 480 | var rock:QuickObject = sim.addCircle({radius:1.2, x:22, y:5, density:100, skin:RollingRock1}); 481 | LVL512Parts.push(rock); 482 | rock.body.SetLinearVelocity(new b2Vec2(-10, 0)); 483 | } 484 | 485 | function CreateLevel513():void 486 | { 487 | GrassDefault(); 488 | 489 | LVL513Parts.push(sim.addBox({x:4, y:9, width:8, height:.1})); 490 | 491 | LVL513Parts.push(sim.addBox({x:16, y:12, width:16, height:.1})); 492 | 493 | LVL513Parts.push(sim.addBox({x:8, y:10.5, width:.1, height:3})); 494 | } 495 | 496 | function CreateLevel514():void 497 | { 498 | GrassDefault(); 499 | 500 | LVL514Parts.push(sim.addBox({x:2, y:12, width:4, height:.1})); 501 | 502 | LVL514Parts.push(sim.addBox({x:7, y:10.5, width:6, height:.1})); 503 | 504 | LVL514Parts.push(sim.addBox({x:13, y:12, width:6, height:.1})); 505 | 506 | LVL514Parts.push(sim.addBox({x:18, y:7, width:.1, height:15})); 507 | 508 | LVL514Parts.push(sim.addBox({x:15.9, y:13, width:.1, height:2})); 509 | } 510 | 511 | function CreateLevel414():void 512 | { 513 | GrassDefault(); 514 | 515 | LVL414Parts.push(sim.addBox({x:18, y:7, width:.1, height:15, friction:0})); 516 | 517 | LVL414Parts.push(sim.addBox({x:15.9, y:7, width:.1, height:15, friction:0})); 518 | } 519 | 520 | function CreateLevel314():void 521 | { 522 | GrassDefault(); 523 | LVL314Parts.push(sim.addBox({x:18, y:7, width:.1, height:15, friction:0})); 524 | 525 | LVL314Parts.push(sim.addBox({x:15.9, y:7, width:.1, height:15, friction:0})); 526 | } 527 | 528 | function CreateLevel214():void 529 | { 530 | GrassDefault(); 531 | LVL214Parts.push(sim.addBox({x:18, y:7, width:.1, height:15, friction:0})); 532 | 533 | LVL214Parts.push(sim.addBox({x:15.9, y:7, width:.1, height:15, friction:0})); 534 | } 535 | 536 | function CreateLevel114():void 537 | { 538 | GrassDefault(); 539 | LVL114Parts.push(sim.addBox({x:4.5, y:8, width:.1, height:2})); 540 | 541 | LVL114Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 542 | } 543 | 544 | function CreateLevel115():void 545 | { 546 | GrassDefault(); 547 | LVL115Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 548 | } 549 | 550 | function CreateLevel116():void 551 | { 552 | GrassDefault(); 553 | LVL116Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 554 | 555 | LVL116Parts.push(sim.addBox({x:18, y:7, width:4, height:.1})); 556 | 557 | LVL116Parts.push(sim.addBox({x:16, y:8, width:.1, height:2})); 558 | 559 | LVL116Parts.push(sim.addBox({x:20, y:8, width:.1, height:2})); 560 | 561 | ObjectsDefault(); 562 | 563 | LVL116Parts.push(sim.addBox({x:18, y:6, width:.8, height:.4, skin:Crown, scaleSkin:false})); 564 | 565 | } 566 | 567 | function CreateLevel107():void 568 | { 569 | GrassDefault(); 570 | LVL107Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 571 | } 572 | 573 | function CreateLevel108():void 574 | { 575 | GrassDefault(); 576 | LVL108Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 577 | 578 | LVL108Parts.push(sim.addBox({x:19, y:8, width:.1, height:2})); 579 | } 580 | 581 | function CreateLevel106():void 582 | { 583 | GrassDefault(); 584 | LVL106Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 585 | } 586 | 587 | function CreateLevel105():void 588 | { 589 | GrassDefault(); 590 | LVL105Parts.push(sim.addBox({x:12, y:10, width:24, height:.1})); 591 | 592 | ObjectsDefault(); 593 | LVL105Parts.push(sim.addBox({x:6, y:9, width:.8, height:.4, density:100, skin:Crown, scaleSkin:false})); 594 | } 595 | 596 | /*LVL VARS*/ 597 | 598 | var LVL901Parts:Array = []; 599 | var LVL801Parts:Array = []; 600 | var LVL701Parts:Array = []; 601 | var LVL702Parts:Array = []; 602 | var LVL703Parts:Array = []; 603 | var LVL603Parts:Array = []; 604 | var LVL502Parts:Array = []; 605 | var LVL503Parts:Array = []; 606 | var LVL504Parts:Array = []; 607 | var LVL505Parts:Array = []; 608 | var LVL506Parts:Array = []; 609 | var LVL507Parts:Array = []; 610 | var LVL508Parts:Array = []; 611 | var LVL509Parts:Array = []; 612 | 613 | var LVL609Parts:Array = []; 614 | var LVL610Parts:Array = []; 615 | 616 | var LVL510Parts:Array = []; 617 | var LVL511Parts:Array = []; 618 | var LVL512Parts:Array = []; 619 | var LVL513Parts:Array = []; 620 | 621 | var LVL902Parts:Array = []; 622 | var LVL802Parts:Array = []; 623 | var LVL704Parts:Array = []; 624 | var LVL602Parts:Array = []; 625 | var LVL604Parts:Array = []; 626 | 627 | var LVL514Parts:Array = []; 628 | var LVL414Parts:Array = []; 629 | var LVL314Parts:Array = []; 630 | var LVL214Parts:Array = []; 631 | var LVL114Parts:Array = []; 632 | var LVL115Parts:Array = []; 633 | var LVL116Parts:Array = []; 634 | 635 | var LVL107Parts:Array = []; 636 | var LVL108Parts:Array = []; 637 | var LVL106Parts:Array = []; 638 | var LVL105Parts:Array = []; -------------------------------------------------------------------------------- /Main.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import flash.display.Sprite; 4 | import flash.events.Event; 5 | import com.actionsnippet.qbox.*; 6 | 7 | /** 8 | * ... 9 | * @author Lucas Molina 10 | */ 11 | public class Main extends Sprite 12 | { 13 | 14 | public function Main():void 15 | { 16 | if (stage) init(); 17 | else addEventListener(Event.ADDED_TO_STAGE, init); 18 | } 19 | 20 | private function init(e:Event = null):void 21 | { 22 | removeEventListener(Event.ADDED_TO_STAGE, init); 23 | // entry point 24 | } 25 | 26 | var sim:QuickBox2D = new QuickBox2D(this); 27 | 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## For King 2 | 3 | For King is a puzzle platformer game about a king in search for his lost crown. 4 | 5 | * Created in a month for the GitHub Game Off competition. 6 | 7 | * Solve puzzles to get to the next screen. 8 | 9 | * Run, jump and push objects. Or get pushed by them! 10 | 11 | * There are also (tree) branches and the flowers are clones, I guess. 12 | 13 | ## Projects Used 14 | 15 | * FlashDevelop 16 | * QuickBox2D -------------------------------------------------------------------------------- /src/Box2D/Collision/ClipVertex.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | import Box2D.Common.Math.*; 23 | import Box2D.Collision.*; 24 | 25 | 26 | public class ClipVertex 27 | { 28 | public var v:b2Vec2 = new b2Vec2(); 29 | public var id:b2ContactID = new b2ContactID(); 30 | }; 31 | 32 | 33 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/Features.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | // We use contact ids to facilitate warm starting. 22 | public class Features 23 | { 24 | ///< The edge that defines the outward contact normal. 25 | public function set referenceEdge(value:int) : void{ 26 | _referenceEdge = value; 27 | _m_id._key = (_m_id._key & 0xffffff00) | (_referenceEdge & 0x000000ff); 28 | } 29 | public function get referenceEdge():int{ 30 | return _referenceEdge; 31 | } 32 | public var _referenceEdge:int; 33 | 34 | ///< The edge most anti-parallel to the reference edge. 35 | public function set incidentEdge(value:int) : void{ 36 | _incidentEdge = value; 37 | _m_id._key = (_m_id._key & 0xffff00ff) | ((_incidentEdge << 8) & 0x0000ff00); 38 | } 39 | public function get incidentEdge():int{ 40 | return _incidentEdge; 41 | } 42 | public var _incidentEdge:int; 43 | 44 | ///< The vertex (0 or 1) on the incident edge that was clipped. 45 | public function set incidentVertex(value:int) : void{ 46 | _incidentVertex = value; 47 | _m_id._key = (_m_id._key & 0xff00ffff) | ((_incidentVertex << 16) & 0x00ff0000); 48 | } 49 | public function get incidentVertex():int{ 50 | return _incidentVertex; 51 | } 52 | public var _incidentVertex:int; 53 | 54 | ///< A value of 1 indicates that the reference edge is on shape2. 55 | public function set flip(value:int) : void{ 56 | _flip = value; 57 | _m_id._key = (_m_id._key & 0x00ffffff) | ((_flip << 24) & 0xff000000); 58 | } 59 | public function get flip():int{ 60 | return _flip; 61 | } 62 | public var _flip:int; 63 | 64 | 65 | public var _m_id:b2ContactID; 66 | }; 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/Box2D/Collision/b2AABB.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.*; 22 | import Box2D.Common.Math.*; 23 | 24 | // A manifold for two touching convex shapes. 25 | public class b2AABB 26 | { 27 | /// Verify that the bounds are sorted. 28 | public function IsValid():Boolean{ 29 | //b2Vec2 d = upperBound - lowerBound;; 30 | var dX:Number = upperBound.x - lowerBound.x; 31 | var dY:Number = upperBound.y - lowerBound.y; 32 | var valid:Boolean = dX >= 0.0 && dY >= 0.0; 33 | valid = valid && lowerBound.IsValid() && upperBound.IsValid(); 34 | return valid; 35 | } 36 | 37 | public var lowerBound:b2Vec2 = new b2Vec2(); ///< the lower vertex 38 | public var upperBound:b2Vec2 = new b2Vec2(); ///< the upper vertex 39 | }; 40 | 41 | 42 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2Bound.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | public class b2Bound{ 23 | public function IsLower():Boolean { return (value & 1) == 0; } 24 | public function IsUpper():Boolean { return (value & 1) == 1; } 25 | public function Swap(b:b2Bound) : void{ 26 | var tempValue:uint = value; 27 | var tempProxyId:uint = proxyId; 28 | var tempStabbingCount:uint = stabbingCount; 29 | 30 | value = b.value; 31 | proxyId = b.proxyId; 32 | stabbingCount = b.stabbingCount; 33 | 34 | b.value = tempValue; 35 | b.proxyId = tempProxyId; 36 | b.stabbingCount = tempStabbingCount; 37 | } 38 | 39 | public var value:uint; 40 | public var proxyId:uint; 41 | public var stabbingCount:uint; 42 | } 43 | 44 | 45 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2BoundValues.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | public class b2BoundValues{ 23 | public var lowerValues:Array = [0,0]; 24 | public var upperValues:Array = [0,0]; 25 | } 26 | 27 | 28 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2BufferedPair.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | public class b2BufferedPair{ 23 | public var proxyId1:uint; 24 | public var proxyId2:uint; 25 | } 26 | 27 | 28 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2ContactID.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.Features; 22 | 23 | // We use contact ids to facilitate warm starting. 24 | public class b2ContactID 25 | { 26 | public function b2ContactID(){ 27 | features._m_id = this; 28 | 29 | } 30 | public function Set(id:b2ContactID) : void{ 31 | key = id._key; 32 | } 33 | public function Copy():b2ContactID{ 34 | var id:b2ContactID = new b2ContactID(); 35 | id.key = key; 36 | return id; 37 | } 38 | public function get key():uint { 39 | return _key; 40 | } 41 | public function set key(value:uint) : void { 42 | _key = value; 43 | features._referenceEdge = _key & 0x000000ff; 44 | features._incidentEdge = ((_key & 0x0000ff00) >> 8) & 0x000000ff; 45 | features._incidentVertex = ((_key & 0x00ff0000) >> 16) & 0x000000ff; 46 | features._flip = ((_key & 0xff000000) >> 24) & 0x000000ff; 47 | } 48 | public var features:Features = new Features(); 49 | public var _key:uint;///< Used to quickly compare contact ids. 50 | }; 51 | 52 | 53 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2ContactPoint.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.*; 22 | import Box2D.Collision.Shapes.*; 23 | import Box2D.Common.Math.*; 24 | 25 | /// This structure is used to report contact points. 26 | public class b2ContactPoint 27 | { 28 | public var shape1:b2Shape; ///< the first shape 29 | public var shape2:b2Shape; ///< the second shape 30 | public var position:b2Vec2 = new b2Vec2(); ///< position in world coordinates 31 | public var velocity:b2Vec2 = new b2Vec2(); ///< velocity of point on body2 relative to point on body1 (pre-solver) 32 | public var normal:b2Vec2 = new b2Vec2(); ///< points from shape1 to shape2 33 | public var separation:Number; ///< the separation is negative when shapes are touching 34 | public var friction:Number; ///< the combined friction coefficient 35 | public var restitution:Number; ///< the combined restitution coefficient 36 | public var id:b2ContactID = new b2ContactID(); ///< the contact id identifies the features in contact 37 | }; 38 | 39 | 40 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2Manifold.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.* 22 | import Box2D.Common.Math.* 23 | import Box2D.Common.* 24 | 25 | // A manifold for two touching convex shapes. 26 | public class b2Manifold 27 | { 28 | public function b2Manifold(){ 29 | points = new Array(b2Settings.b2_maxManifoldPoints); 30 | for (var i:int = 0; i < b2Settings.b2_maxManifoldPoints; i++){ 31 | points[i] = new b2ManifoldPoint(); 32 | } 33 | normal = new b2Vec2(); 34 | } 35 | public function Reset() : void{ 36 | for (var i:int = 0; i < b2Settings.b2_maxManifoldPoints; i++){ 37 | (points[i] as b2ManifoldPoint).Reset(); 38 | } 39 | normal.SetZero(); 40 | pointCount = 0; 41 | } 42 | public function Set(m:b2Manifold) : void{ 43 | pointCount = m.pointCount; 44 | for (var i:int = 0; i < b2Settings.b2_maxManifoldPoints; i++){ 45 | (points[i] as b2ManifoldPoint).Set(m.points[i]); 46 | } 47 | normal.SetV(m.normal); 48 | } 49 | public var points:Array; ///< the points of contact 50 | public var normal:b2Vec2; ///< the shared unit normal vector 51 | public var pointCount:int = 0; ///< the number of manifold points 52 | }; 53 | 54 | 55 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2ManifoldPoint.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.* 22 | import Box2D.Common.Math.* 23 | 24 | /// A manifold point is a contact point belonging to a contact 25 | /// manifold. It holds details related to the geometry and dynamics 26 | /// of the contact points. 27 | /// The point is stored in local coordinates because CCD 28 | /// requires sub-stepping in which the separation is stale. 29 | public class b2ManifoldPoint 30 | { 31 | public function Reset() : void{ 32 | localPoint1.SetZero(); 33 | localPoint2.SetZero(); 34 | separation = 0.0; 35 | normalImpulse = 0.0; 36 | tangentImpulse = 0.0; 37 | id.key = 0; 38 | } 39 | public function Set(m:b2ManifoldPoint) : void{ 40 | localPoint1.SetV(m.localPoint1); 41 | localPoint2.SetV(m.localPoint2); 42 | separation = m.separation; 43 | normalImpulse = m.normalImpulse; 44 | tangentImpulse = m.tangentImpulse; 45 | id.key = m.id.key; 46 | } 47 | public var localPoint1:b2Vec2 = new b2Vec2(); 48 | public var localPoint2:b2Vec2 = new b2Vec2(); 49 | public var separation:Number; 50 | public var normalImpulse:Number; 51 | public var tangentImpulse:Number; 52 | public var id:b2ContactID = new b2ContactID(); 53 | }; 54 | 55 | 56 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2OBB.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Common.Math.*; 22 | 23 | /// An oriented bounding box. 24 | public class b2OBB 25 | { 26 | public var R:b2Mat22 = new b2Mat22(); ///< the rotation matrix 27 | public var center:b2Vec2 = new b2Vec2(); ///< the local centroid 28 | public var extents:b2Vec2 = new b2Vec2(); ///< the half-widths 29 | }; 30 | 31 | 32 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2PairCallback.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | public class b2PairCallback 23 | { 24 | //virtual ~b2PairCallback() {} 25 | 26 | // This returns the new pair user data. 27 | public virtual function PairAdded(proxyUserData1:*, proxyUserData2:*):*{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 virtual function PairRemoved(proxyUserData1:*, proxyUserData2:*, pairUserData:*) : void{}; 32 | }; 33 | 34 | 35 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2Point.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | import Box2D.Collision.*; 22 | import Box2D.Common.Math.*; 23 | 24 | // This is used for polygon-vs-circle distance. 25 | public class b2Point 26 | { 27 | public function Support(xf:b2XForm, vX:Number, vY:Number) : b2Vec2 28 | { 29 | return p; 30 | } 31 | 32 | public function GetFirstVertex(xf:b2XForm) : b2Vec2 33 | { 34 | return p; 35 | } 36 | 37 | public var p:b2Vec2 = new b2Vec2(); 38 | }; 39 | 40 | 41 | } -------------------------------------------------------------------------------- /src/Box2D/Collision/b2Proxy.as: -------------------------------------------------------------------------------- 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 | package Box2D.Collision{ 20 | 21 | 22 | public class b2Proxy{ 23 | public function GetNext():uint { return lowerBounds[0]; } 24 | public function SetNext(next:uint) : void { lowerBounds[0] = next & 0x0000ffff; } 25 | 26 | public function IsValid():Boolean { return overlapCount != b2BroadPhase.b2_invalid; } 27 | 28 | public var lowerBounds:Array = [uint(0), uint(0)]; 29 | public var upperBounds:Array = [uint(0), uint(0)]; 30 | public var overlapCount:uint; 31 | public var timeStamp:uint; 32 | 33 | public var userData:* = null; 34 | } 35 | 36 | 37 | } -------------------------------------------------------------------------------- /src/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AD1337/ForKingGame/95fc6b9dd0b6e782a01e047e041bff62e175766f/src/com/.DS_Store --------------------------------------------------------------------------------