Learn how to recreate the new super-hit mobile game Spinny Gun using just a few tweens and a bit of trigonometry.

Posted on 29th Aug 2019. Follow @phaser_ and get the Phaser World newsletter.


Emanuele Feronato gets inspired by a popular new game: "Ketchapp did it again. Spinny Gun available for both iOS and Android is the 10,000th hyper-casual game made by this studio which becomes a smashing hit.

"Shoot as many targets as you can in this new addictive game!" the description says, and actually that’s all! There is a spinning gun and a series of targets moving around a circular path.

So we have objects moving along a path and rotating accordingly, bullets fired from a spinning gun and a collision routine checking for bullets trajectory. Which physics engine should we choose? No one.

Thanks to Phaser 3 paths, we can draw a path just like we are used to draw on graphic canvas with lines, curves and arcs, then make sprites follow such path tweening their positions with all the kind of controls we expect to be capable of when tweening a sprite: easing, speed, repeating, yoyo effects and more.

As for the collision system, we are only using trigonometry to determine the line of fire and check for intersection with targets bounding box.

Have a look at the example..."

Read More

Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.

The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
  • By Emanuele Feronato
  • 155 Pages
  • 28 Source Code Examples
  • Build a complete game from start to finish
  • Cross Platform
  • Scaling for devices
Buy Now