{"author_link":"\/users\/gamepopper","author_name":"gamepopper","author_uid":"gamepopper","comments":[],"epoch":1493589477,"event":"LD38","format":"md","ldjam_node_id":29091,"likes":5,"metadata":{"p_key":"91976","p_author":"gamepopper","p_authorkey":"1002636","p_urlkey":"304894","p_title":"How I made littleBLASTplanet","p_cat":"LDJam ","p_event":"LD38","p_time":"1493589477","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":"1002636","us_name":"gamepopper","us_username":"gamepopper","event_start":"1492732800","event_key":"69","event_name":"LD 38"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD38","removed_author":false},"_superparent":9405,"_trust":10,"author":2636,"body":"Since voting is upon us, I thought I'd share with you the progression of how my entry came to be...\n\nThe theme this time around was Small World, so I (like a lot of devs) made a game either around a small game world or a tiny planet. I went with the latter and drew up a run \u2018n gun shooter on a little planet.\n\n![photo.jpg](\/\/\/raw\/c4a\/z\/2d8c.jpg)\n\nSadly I had plans with my friends on Saturday so I didn\u2019t start work on the game until around 8PM GMT, so development felt more rushed than a full games jam but I managed to make what I set out to design: littleBLASTplanet\n\n![cover.png](\/\/\/raw\/c4a\/z\/2d8d.png)\n\nSimilar to my past Ludum Dare projects, I used HaxeFlixel. It\u2019s straightforward to use, multiplatform (Flash, HTML, Windows and Android maybe\u2026) and it\u2019s still being maintained so there have been several improvements. I\u2019ve provided the game\u2019s source code on [Github](https:\/\/github.com\/gamepopper\/little-BLAST-planet) so feel free to have a look to see how the game works.\n\nThe first problem I had to solve to make this game work is how to make a sprite orbit a planet. HaxeFlixel has a FlxVector object for vector math, so using that with a sprite\u2019s acceleration meant having the sprite fall towards the centre of a circular planet was pretty easy, but how do you get the sprite to stop on the planet\u2019s surface?\n\nHaxeFlixel has no circular collision, only rectangtle collision. When I wrote my own [C++ framework](https:\/\/github.com\/gamepopper\/Vigilante-Game-Framework) for a game on Steam called [Gemstone Keeper](http:\/\/store.steampowered.com\/app\/522080\/), a framework which took inspirations from HaxeFlixel, I included Circular collision by giving each object a Radius property and writing my own circle overlap and separation functions. This would have been too much work for the time I had, so I wrote a hack method for a derived sprite class that always checked and updated the distance between a sprite\u2019s centre and the planet\u2019s centre, and if the distance was less than both the planet\u2019s radius and sprite\u2019s radius combined, then the game pushes the sprite up to the edge of the planet. This circle collision method is only applied between a sprite and the planet, and since rectangles don\u2019t rotate then all sprites had to be perfect squares.\n\nBullets were one of the only sprites that weren\u2019t built to orbit the planet, instead simply moving in an angle that combines the firing direction with the player\u2019s current angle. I\u2019ve had some feedback that said that the bullets should also be affected by gravity. I decided against it because it would make enemies on the planet easier to hit, while enemies in the sky would be harder to aim, not to mention the game loses a strategy element because of where bullets travel.\n\n![549cfnU.gif](\/\/\/raw\/c4a\/z\/2da3.gif) ![Yo7H0DS.gif](\/\/\/raw\/c4a\/z\/2d9a.gif)\n\nI went with three base enemy types: Rockets, Spikes and Robots.\n\nRobots functions no differently from the player, except that it moves in a fix direction and smaller ones bounce by constantly jumping. Spikes has the same orbiting system, but it\u2019s planet radius is much smaller to allow it to go into the planet. I use FlxTween and the FlxTimer to allow the spikes to move in sequence. Rockets simply spawn outside the screen at an angle and move towards the centre of the planet. If a rocket touches the planet then it would be destroyed, resulting in an instant game over.\n\n![9LIF5SU.gif](\/\/\/raw\/c4a\/z\/2da5.gif)\n\nI also added an escape object, which changes the planets side and makes the level a little bit more harder. This was for variety, so you wouldn\u2019t have to stay on the same planet. If I had a bit more time I would have included more animations on the planet itself.\n\nSpeaking of the planet, that was one of the first objects I applied polished graphics to. To give it a more detailed pattern, I used the built in Cellular Automata function, and applied the pixels to the circle. Since it uses a random seed, the pattern is different on each playthrough.\n\n![i1eCgNW.gif](\/\/\/raw\/c4a\/z\/2d9b.gif)\n\nThe planet\u2019s destruction is a particle effect that uses the planet sprite\u2019s texture, a technique I used a lot in Gemstone Keeper. However one gripe was that I had to make a derived FlxEmitter class that could allow me to set how many frames I wanted based on the particle\u2019s frame size.\n\n![uA6BKVk.gif](\/\/\/raw\/c4a\/z\/2d9c.gif)\n\nAlong with proper sprites, smoke was added to the spikes so that the game can provide a one second warning before spikes hit. I also added a distance check to avoid some unfair spike deaths. Finally I added a second camera mode incase the first one wasn\u2019t interesting enough. The follow camera simply rotates with the player so they can stay in one spot while all the other objects rotated around. It did mean having to create a new Camera for UI elements, since objects can only be parallax scrolled by position.\n\n![gAxHlD8.gif](\/\/\/raw\/c4a\/z\/2da6.gif)\n\nThe last elements I added were the title screen and audio. Sound effects were produced with [BFXR](http:\/\/www.bfxr.net\/) and music with Abundent-Music\u2019s [Procedural Music Generator](http:\/\/www.abundant-music.com\/). Audio is one of my weakest skills so these procedural tools made that quick and simple, although I probably wouldn\u2019t enter myself into the audio category for them.\n\nI figured I add a smaller version of the planet in the title screen and have the player sprite on a bigger world to give a vague sense of a setting, with emphasis that the player is fighting on tiny planets and not just a giant on a regular sized planet.\n\nAnd that\u2019s basically how I made littleBLASTplanet. If I had more time I probably would have created more enemies and made proper transitions between planets. Aside from that I\u2019m pretty happy with the results, particularly hacking the physics to getting jumping and moving around a 2D planet to be possible.\n\nVoting for the game begins tonight, so if you took part in Ludum Dare, [please check it out](https:\/\/ldjam.com\/events\/ludum-dare\/38\/$15273)!","comments":0,"created":"2017-04-30T17:20:05Z","files":[],"files-timestamp":0,"id":29091,"love":5,"love-timestamp":"2017-05-01T00:06:20Z","meta":[],"modified":"2017-05-01T00:06:20Z","name":"How I made littleBLASTplanet","node-timestamp":"2017-04-30T21:58:42Z","parent":15273,"parents":[1,5,9,9405,15273],"path":"\/events\/ludum-dare\/38\/little-blast-planet\/how-i-made-littleblastplanet","published":"2017-04-30T21:57:57Z","scope":"public","slug":"how-i-made-littleblastplanet","subsubtype":"","subtype":"","type":"post","version":72480},"node_metadata":{"n_key":"29091","n_urlkey":"304894","n_parent":"15273","n_path":"\/events\/ludum-dare\/38\/little-blast-planet\/how-i-made-littleblastplanet","n_slug":"how-i-made-littleblastplanet","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"2636","n_created":"1493572805","n_modified":"1493597180","n_version":"72480","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/38\/little-blast-planet\/how-i-made-littleblastplanet","text":"Since voting is upon us, I thought I'd share with you the progression of how my entry came to be...\n\nThe theme this time around was Small World, so I (like a lot of devs) made a game either around a small game world or a tiny planet. I went with the latter and drew up a run \u2018n gun shooter on a little planet.\n\n![photo.jpg](\/\/\/raw\/c4a\/z\/2d8c.jpg)\n\nSadly I had plans with my friends on Saturday so I didn\u2019t start work on the game until around 8PM GMT, so development felt more rushed than a full games jam but I managed to make what I set out to design: littleBLASTplanet\n\n![cover.png](\/\/\/raw\/c4a\/z\/2d8d.png)\n\nSimilar to my past Ludum Dare projects, I used HaxeFlixel. It\u2019s straightforward to use, multiplatform (Flash, HTML, Windows and Android maybe\u2026) and it\u2019s still being maintained so there have been several improvements. I\u2019ve provided the game\u2019s source code on [Github](https:\/\/github.com\/gamepopper\/little-BLAST-planet) so feel free to have a look to see how the game works.\n\nThe first problem I had to solve to make this game work is how to make a sprite orbit a planet. HaxeFlixel has a FlxVector object for vector math, so using that with a sprite\u2019s acceleration meant having the sprite fall towards the centre of a circular planet was pretty easy, but how do you get the sprite to stop on the planet\u2019s surface?\n\nHaxeFlixel has no circular collision, only rectangtle collision. When I wrote my own [C++ framework](https:\/\/github.com\/gamepopper\/Vigilante-Game-Framework) for a game on Steam called [Gemstone Keeper](http:\/\/store.steampowered.com\/app\/522080\/), a framework which took inspirations from HaxeFlixel, I included Circular collision by giving each object a Radius property and writing my own circle overlap and separation functions. This would have been too much work for the time I had, so I wrote a hack method for a derived sprite class that always checked and updated the distance between a sprite\u2019s centre and the planet\u2019s centre, and if the distance was less than both the planet\u2019s radius and sprite\u2019s radius combined, then the game pushes the sprite up to the edge of the planet. This circle collision method is only applied between a sprite and the planet, and since rectangles don\u2019t rotate then all sprites had to be perfect squares.\n\nBullets were one of the only sprites that weren\u2019t built to orbit the planet, instead simply moving in an angle that combines the firing direction with the player\u2019s current angle. I\u2019ve had some feedback that said that the bullets should also be affected by gravity. I decided against it because it would make enemies on the planet easier to hit, while enemies in the sky would be harder to aim, not to mention the game loses a strategy element because of where bullets travel.\n\n![549cfnU.gif](\/\/\/raw\/c4a\/z\/2da3.gif) ![Yo7H0DS.gif](\/\/\/raw\/c4a\/z\/2d9a.gif)\n\nI went with three base enemy types: Rockets, Spikes and Robots.\n\nRobots functions no differently from the player, except that it moves in a fix direction and smaller ones bounce by constantly jumping. Spikes has the same orbiting system, but it\u2019s planet radius is much smaller to allow it to go into the planet. I use FlxTween and the FlxTimer to allow the spikes to move in sequence. Rockets simply spawn outside the screen at an angle and move towards the centre of the planet. If a rocket touches the planet then it would be destroyed, resulting in an instant game over.\n\n![9LIF5SU.gif](\/\/\/raw\/c4a\/z\/2da5.gif)\n\nI also added an escape object, which changes the planets side and makes the level a little bit more harder. This was for variety, so you wouldn\u2019t have to stay on the same planet. If I had a bit more time I would have included more animations on the planet itself.\n\nSpeaking of the planet, that was one of the first objects I applied polished graphics to. To give it a more detailed pattern, I used the built in Cellular Automata function, and applied the pixels to the circle. Since it uses a random seed, the pattern is different on each playthrough.\n\n![i1eCgNW.gif](\/\/\/raw\/c4a\/z\/2d9b.gif)\n\nThe planet\u2019s destruction is a particle effect that uses the planet sprite\u2019s texture, a technique I used a lot in Gemstone Keeper. However one gripe was that I had to make a derived FlxEmitter class that could allow me to set how many frames I wanted based on the particle\u2019s frame size.\n\n![uA6BKVk.gif](\/\/\/raw\/c4a\/z\/2d9c.gif)\n\nAlong with proper sprites, smoke was added to the spikes so that the game can provide a one second warning before spikes hit. I also added a distance check to avoid some unfair spike deaths. Finally I added a second camera mode incase the first one wasn\u2019t interesting enough. The follow camera simply rotates with the player so they can stay in one spot while all the other objects rotated around. It did mean having to create a new Camera for UI elements, since objects can only be parallax scrolled by position.\n\n![gAxHlD8.gif](\/\/\/raw\/c4a\/z\/2da6.gif)\n\nThe last elements I added were the title screen and audio. Sound effects were produced with [BFXR](http:\/\/www.bfxr.net\/) and music with Abundent-Music\u2019s [Procedural Music Generator](http:\/\/www.abundant-music.com\/). Audio is one of my weakest skills so these procedural tools made that quick and simple, although I probably wouldn\u2019t enter myself into the audio category for them.\n\nI figured I add a smaller version of the planet in the title screen and have the player sprite on a bigger world to give a vague sense of a setting, with emphasis that the player is fighting on tiny planets and not just a giant on a regular sized planet.\n\nAnd that\u2019s basically how I made littleBLASTplanet. If I had more time I probably would have created more enemies and made proper transitions between planets. Aside from that I\u2019m pretty happy with the results, particularly hacking the physics to getting jumping and moving around a 2D planet to be possible.\n\nVoting for the game begins tonight, so if you took part in Ludum Dare, [please check it out](https:\/\/ldjam.com\/events\/ludum-dare\/38\/$15273)!","title":"How I made littleBLASTplanet","wayback_source":[]}