diff --git a/README.md b/README.md index 628f60b2..6880acc2 100644 --- a/README.md +++ b/README.md @@ -102,12 +102,15 @@ Version 1.0.7 (in progress in the dev branch) * Group.create now sets the visible and alive properties of the Sprite to the same value as the 'exists' parameter. * Added Group.total. Same as Group.length, but more in line with the rest of the Group naming. * Added Sprite.outOfBoundsKill boolean flag. Will automatically kill a sprite that leaves the game World bounds (off by default). -* ArcadePhysics.moveTowardsMouse changed to ArcadePhysics.moveTowardsPointer and now lets you specify which pointer to move towards (defaults to Input.activePointer). -* ArcadePhysics.angleBetweenMouse changed to ArcadePhysics.angleBetweenPointer and now lets you specify which pointer to get the angle to (defaults to Input.activePointer). -* ArcadePhysics.velocityFromAngle and ArcadePhysics.velocityFromRotation added with examples created. +* Lots of changes and fixes in ArcadePhysics, including: +* Functions with "mouse" in the title have been updated to "pointer" to more accurately reflect what they do. +* New velocity functions: moveToObject, moveToPointer, moveToXY +* New acceleration functions: accelerateToObject, accelerateToPointer, accelerateToXY +* New distance functions: distanceBetween, distanceToXY, distanceToPointer +* New angle functions: angleBetween, angleToXY, angleToPointer +* velocityFromAngle and velocityFromRotation added with examples created. * Fixed the RandomDataGenerator.sow method so if you give in the same seed you'll now get the same results (thanks Hsaka) - * TODO: look at Sprite.crop (http://www.html5gamedevs.com/topic/1617-error-in-spritecrop/) * TODO: d-pad example (http://www.html5gamedevs.com/topic/1574-gameinputondown-question/) * TODO: more touch input examples (http://www.html5gamedevs.com/topic/1556-mobile-touch-event/) diff --git a/examples/assets/games/atoms/atom1a.png b/examples/assets/games/atoms/atom1a.png new file mode 100644 index 00000000..50446355 Binary files /dev/null and b/examples/assets/games/atoms/atom1a.png differ diff --git a/examples/assets/games/atoms/atom1b.png b/examples/assets/games/atoms/atom1b.png new file mode 100644 index 00000000..ceec3677 Binary files /dev/null and b/examples/assets/games/atoms/atom1b.png differ diff --git a/examples/assets/games/atoms/atom2a.png b/examples/assets/games/atoms/atom2a.png new file mode 100644 index 00000000..34243d5c Binary files /dev/null and b/examples/assets/games/atoms/atom2a.png differ diff --git a/examples/assets/games/atoms/atom2b.png b/examples/assets/games/atoms/atom2b.png new file mode 100644 index 00000000..456c31fd Binary files /dev/null and b/examples/assets/games/atoms/atom2b.png differ diff --git a/examples/assets/games/atoms/atom3a.png b/examples/assets/games/atoms/atom3a.png new file mode 100644 index 00000000..63d56719 Binary files /dev/null and b/examples/assets/games/atoms/atom3a.png differ diff --git a/examples/assets/games/atoms/atom3b.png b/examples/assets/games/atoms/atom3b.png new file mode 100644 index 00000000..4f59c1ef Binary files /dev/null and b/examples/assets/games/atoms/atom3b.png differ diff --git a/examples/assets/games/atoms/atom4a.png b/examples/assets/games/atoms/atom4a.png new file mode 100644 index 00000000..d3d43191 Binary files /dev/null and b/examples/assets/games/atoms/atom4a.png differ diff --git a/examples/assets/games/atoms/atom4b.png b/examples/assets/games/atoms/atom4b.png new file mode 100644 index 00000000..3d8e2cc7 Binary files /dev/null and b/examples/assets/games/atoms/atom4b.png differ diff --git a/examples/assets/games/atoms/explode.png b/examples/assets/games/atoms/explode.png new file mode 100644 index 00000000..2dc169fc Binary files /dev/null and b/examples/assets/games/atoms/explode.png differ diff --git a/examples/assets/games/atoms/grid.png b/examples/assets/games/atoms/grid.png new file mode 100644 index 00000000..adc8e683 Binary files /dev/null and b/examples/assets/games/atoms/grid.png differ diff --git a/examples/assets/games/tanks/dark_grass.png b/examples/assets/games/tanks/dark_grass.png new file mode 100644 index 00000000..2f21c629 Binary files /dev/null and b/examples/assets/games/tanks/dark_grass.png differ diff --git a/examples/assets/games/tanks/earth.png b/examples/assets/games/tanks/earth.png new file mode 100644 index 00000000..ab6ba7b1 Binary files /dev/null and b/examples/assets/games/tanks/earth.png differ diff --git a/examples/assets/games/tanks/light_grass.png b/examples/assets/games/tanks/light_grass.png new file mode 100644 index 00000000..27650aad Binary files /dev/null and b/examples/assets/games/tanks/light_grass.png differ diff --git a/examples/assets/games/tanks/light_sand.png b/examples/assets/games/tanks/light_sand.png new file mode 100644 index 00000000..bd577593 Binary files /dev/null and b/examples/assets/games/tanks/light_sand.png differ diff --git a/examples/assets/games/tanks/sand.png b/examples/assets/games/tanks/sand.png new file mode 100644 index 00000000..7fc72edf Binary files /dev/null and b/examples/assets/games/tanks/sand.png differ diff --git a/examples/assets/games/tanks/scorched_earth.png b/examples/assets/games/tanks/scorched_earth.png new file mode 100644 index 00000000..6809b44a Binary files /dev/null and b/examples/assets/games/tanks/scorched_earth.png differ diff --git a/examples/assets/games/tanks/shadow.png b/examples/assets/games/tanks/shadow.png new file mode 100644 index 00000000..902e7912 Binary files /dev/null and b/examples/assets/games/tanks/shadow.png differ diff --git a/examples/assets/games/tanks/tank1.png b/examples/assets/games/tanks/tank1.png new file mode 100644 index 00000000..19bf547d Binary files /dev/null and b/examples/assets/games/tanks/tank1.png differ diff --git a/examples/assets/games/tanks/tank2.png b/examples/assets/games/tanks/tank2.png new file mode 100644 index 00000000..b6d8d9d3 Binary files /dev/null and b/examples/assets/games/tanks/tank2.png differ diff --git a/examples/assets/games/tanks/tank3.png b/examples/assets/games/tanks/tank3.png new file mode 100644 index 00000000..ff7f0532 Binary files /dev/null and b/examples/assets/games/tanks/tank3.png differ diff --git a/examples/assets/games/tanks/tank4.png b/examples/assets/games/tanks/tank4.png new file mode 100644 index 00000000..5013ab06 Binary files /dev/null and b/examples/assets/games/tanks/tank4.png differ diff --git a/examples/assets/games/tanks/tank5.png b/examples/assets/games/tanks/tank5.png new file mode 100644 index 00000000..8eb41d11 Binary files /dev/null and b/examples/assets/games/tanks/tank5.png differ diff --git a/examples/assets/games/tanks/tank6.png b/examples/assets/games/tanks/tank6.png new file mode 100644 index 00000000..531f15ff Binary files /dev/null and b/examples/assets/games/tanks/tank6.png differ diff --git a/examples/assets/games/tanks/tanks.json b/examples/assets/games/tanks/tanks.json new file mode 100644 index 00000000..ecb2b761 --- /dev/null +++ b/examples/assets/games/tanks/tanks.json @@ -0,0 +1,84 @@ +{"frames": [ + +{ + "filename": "shadow", + "frame": {"x":0,"y":0,"w":80,"h":80}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":80,"h":80}, + "sourceSize": {"w":80,"h":80} +}, +{ + "filename": "tank1", + "frame": {"x":190,"y":52,"w":54,"h":52}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":3,"y":5,"w":54,"h":52}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tank2", + "frame": {"x":136,"y":52,"w":54,"h":52}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":3,"y":5,"w":54,"h":52}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tank3", + "frame": {"x":80,"y":54,"w":56,"h":54}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":2,"y":4,"w":56,"h":54}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tank4", + "frame": {"x":190,"y":0,"w":54,"h":52}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":3,"y":5,"w":54,"h":52}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tank5", + "frame": {"x":136,"y":0,"w":54,"h":52}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":3,"y":5,"w":54,"h":52}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tank6", + "frame": {"x":80,"y":0,"w":56,"h":54}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":2,"y":4,"w":56,"h":54}, + "sourceSize": {"w":64,"h":64} +}, +{ + "filename": "tracks", + "frame": {"x":48,"y":80,"w":24,"h":12}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":24,"h":12}, + "sourceSize": {"w":24,"h":12} +}, +{ + "filename": "turret", + "frame": {"x":0,"y":80,"w":48,"h":28}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":1,"y":2,"w":48,"h":28}, + "sourceSize": {"w":50,"h":32} +}], +"meta": { + "app": "http://www.codeandweb.com/texturepacker ", + "version": "1.0", + "image": "tanks.png", + "format": "RGBA8888", + "size": {"w":244,"h":108}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:99b2f74fa157c5b63e72b0d68be078b4:1/1$" +} +} diff --git a/examples/assets/games/tanks/tanks.png b/examples/assets/games/tanks/tanks.png new file mode 100644 index 00000000..fe6d287c Binary files /dev/null and b/examples/assets/games/tanks/tanks.png differ diff --git a/examples/assets/games/tanks/tanks.tps b/examples/assets/games/tanks/tanks.tps new file mode 100644 index 00000000..8d5f8680 --- /dev/null +++ b/examples/assets/games/tanks/tanks.tps @@ -0,0 +1,172 @@ + + + + fileFormatVersion + 1 + variation + main + verbose + + autoSDSettings + + allowRotation + + quiet + + premultiplyAlpha + + shapeDebug + + dpi + 72 + dataFormat + json-array + textureFileName + tanks.png + flipPVR + + ditherType + NearestNeighbour + backgroundColor + 0 + libGdx + + filtering + + x + Linear + y + Linear + + + shapePadding + 0 + jpgQuality + 80 + pngOptimizationLevel + 0 + textureSubPath + + textureFormat + png + borderPadding + 0 + maxTextureSize + + width + 512 + height + 512 + + fixedTextureSize + + width + -1 + height + -1 + + reduceBorderArtifacts + + algorithmSettings + + algorithm + MaxRects + freeSizeMode + Best + sizeConstraints + AnySize + forceSquared + + forceWordAligned + + maxRects + + heuristic + Best + + basic + + sortBy + Name + order + Ascending + + + andEngine + + minFilter + Linear + packageName + Texture + javaFileName + tanks.java + wrap + + s + Clamp + t + Clamp + + magFilter + MagLinear + + dataFileName + tanks.json + multiPack + + mainExtension + + forceIdenticalLayout + + outputFormat + RGBA8888 + contentProtection + + key + + + autoAliasEnabled + + trimSpriteNames + + globalSpriteSettings + + scale + 1 + scaleMode + Smooth + innerPadding + 0 + extrude + 0 + trimThreshold + 1 + trimMode + Trim + heuristicMask + + + fileList + + shadow.png + tank1.png + tank2.png + tank3.png + tank4.png + tank5.png + tank6.png + tracks.png + turret.png + + ignoreFileList + + replaceList + + ignoredWarnings + + commonDivisorX + 1 + commonDivisorY + 1 + + diff --git a/examples/assets/games/tanks/tracks.png b/examples/assets/games/tanks/tracks.png new file mode 100644 index 00000000..30d1dad7 Binary files /dev/null and b/examples/assets/games/tanks/tracks.png differ diff --git a/examples/assets/games/tanks/turret.png b/examples/assets/games/tanks/turret.png new file mode 100644 index 00000000..e4185ac1 Binary files /dev/null and b/examples/assets/games/tanks/turret.png differ diff --git a/examples/assets/sprites/pangball.png b/examples/assets/sprites/pangball.png new file mode 100644 index 00000000..358c3006 Binary files /dev/null and b/examples/assets/sprites/pangball.png differ diff --git a/examples/games/tanks.php b/examples/games/tanks.php new file mode 100644 index 00000000..ebe398fa --- /dev/null +++ b/examples/games/tanks.php @@ -0,0 +1,170 @@ + + + + + \ No newline at end of file diff --git a/examples/physics/accelerate to pointer.php b/examples/physics/accelerate to pointer.php new file mode 100644 index 00000000..1ad9ecdc --- /dev/null +++ b/examples/physics/accelerate to pointer.php @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/examples/physics/angle between.php b/examples/physics/angle between.php new file mode 100644 index 00000000..8794d7a9 --- /dev/null +++ b/examples/physics/angle between.php @@ -0,0 +1,51 @@ + + + + + \ No newline at end of file diff --git a/examples/physics/angle to pointer.php b/examples/physics/angle to pointer.php index a88f656f..0977ac8b 100644 --- a/examples/physics/angle to pointer.php +++ b/examples/physics/angle to pointer.php @@ -26,7 +26,7 @@ // This will update the sprite.rotation so that it points to the currently active pointer // On a Desktop that is the mouse, on mobile the most recent finger press. - sprite.rotation = game.physics.angleBetweenPointer(sprite); + sprite.rotation = game.physics.angleToPointer(sprite); } diff --git a/examples/physics/multi angle to pointer.php b/examples/physics/multi angle to pointer.php index a78596db..45154c9e 100644 --- a/examples/physics/multi angle to pointer.php +++ b/examples/physics/multi angle to pointer.php @@ -5,7 +5,7 @@