{"author_link":"\/users\/graal","author_name":"GRaAL","author_uid":"graal","comments":[],"epoch":1502143714,"event":"LD39","format":"md","ldjam_node_id":48541,"likes":0,"metadata":{"p_key":"100563","p_author":"GRaAL","p_authorkey":"1000484","p_urlkey":"316273","p_title":"To fix a spaceship while flying","p_cat":"LDJam ","p_event":"LD39","p_time":"1502143714","p_likes":"0","p_comments":"0","p_status":"WAYBACK","us_key":"1000484","us_name":"GRaAL","us_username":"graal","event_start":"1501200000","event_key":"74","event_name":"LD 39"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD39","removed_author":false},"_superparent":32802,"_trust":1,"author":484,"body":"Boring technical guy from Volcanic Giraffe is here. If you don\u2019t want to yawn while reading about coding stuff - better check our [Galvanica game](https:\/\/ldjam.com\/events\/ludum-dare\/39\/galvanica). It is much funnier that its source code :)\n\nA good thing in JS-based open source game engines like Phaser.js is that you may patch them if needed. Phaser.js has structure obvious enought and lot of in-code comments which very help to understand what is going on. Some things could be configurable, but they are not for performance issues. Well, we are programmers here, aren't we?\n\nOne of problems we met: if one sprite is added to another one as child, it is drawn OVER parent sprite. That\u2019s very useful if you want to draw a gun or some clothes. But we wanted to draw a shadow, and it shall be drawn UNDER parent sprite. Why to add it as child? Well, we\u2019d like shadow to \u00abinherit\u00bb some properties of main object (position, alpha, rotation, etc.). If not adding as child - we\u2019d have to apply sprite\u2019s props to shadow manually on every update.\n\nHere how it looks by default:\n![before.png](\/\/\/raw\/4e1\/z\/8c2a.png)\n\nWhat we did: overriden _renderWebGL method of Phaser.Sprite in our BaseItem class and changed order of rendering\n![patch.png](\/\/\/raw\/4e1\/z\/8c2c.png)\n\nSo, how it goes now:\n![after.png](\/\/\/raw\/4e1\/z\/8c2b.png)\n\nMuch better, isn\u2019t it?\n\nDid you even fix\/patch your game engine code during LD? It shall look like burning spaceship furniture in its furnace while flying\u2026 oh, wait, this is what [Galvanica](https:\/\/ldjam.com\/events\/ludum-dare\/39\/galvanica) is about!","comments":3,"comments-timestamp":"2017-08-09T00:17:20Z","created":"2017-08-07T22:02:33Z","files":[],"files-timestamp":0,"id":48541,"love":0,"meta":[],"modified":"2017-08-09T00:17:20Z","name":"To fix a spaceship while flying","node-timestamp":"2017-08-07T22:08:34Z","parent":34630,"parents":[1,5,9,32802,34630],"path":"\/events\/ludum-dare\/39\/galvanica\/to-fix-a-spaceship-while-flying","published":"2017-08-07T22:08:34Z","scope":"public","slug":"to-fix-a-spaceship-while-flying","subsubtype":"","subtype":"","type":"post","version":138321},"node_metadata":{"n_key":"48541","n_urlkey":"316273","n_parent":"34630","n_path":"\/events\/ludum-dare\/39\/galvanica\/to-fix-a-spaceship-while-flying","n_slug":"to-fix-a-spaceship-while-flying","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"484","n_created":"1502143353","n_modified":"1502237840","n_version":"138321","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/39\/galvanica\/to-fix-a-spaceship-while-flying","text":"Boring technical guy from Volcanic Giraffe is here. If you don\u2019t want to yawn while reading about coding stuff - better check our [Galvanica game](https:\/\/ldjam.com\/events\/ludum-dare\/39\/galvanica). It is much funnier that its source code :)\n\nA good thing in JS-based open source game engines like Phaser.js is that you may patch them if needed. Phaser.js has structure obvious enought and lot of in-code comments which very help to understand what is going on. Some things could be configurable, but they are not for performance issues. Well, we are programmers here, aren't we?\n\nOne of problems we met: if one sprite is added to another one as child, it is drawn OVER parent sprite. That\u2019s very useful if you want to draw a gun or some clothes. But we wanted to draw a shadow, and it shall be drawn UNDER parent sprite. Why to add it as child? Well, we\u2019d like shadow to \u00abinherit\u00bb some properties of main object (position, alpha, rotation, etc.). If not adding as child - we\u2019d have to apply sprite\u2019s props to shadow manually on every update.\n\nHere how it looks by default:\n![before.png](\/\/\/raw\/4e1\/z\/8c2a.png)\n\nWhat we did: overriden _renderWebGL method of Phaser.Sprite in our BaseItem class and changed order of rendering\n![patch.png](\/\/\/raw\/4e1\/z\/8c2c.png)\n\nSo, how it goes now:\n![after.png](\/\/\/raw\/4e1\/z\/8c2b.png)\n\nMuch better, isn\u2019t it?\n\nDid you even fix\/patch your game engine code during LD? It shall look like burning spaceship furniture in its furnace while flying\u2026 oh, wait, this is what [Galvanica](https:\/\/ldjam.com\/events\/ludum-dare\/39\/galvanica) is about!","title":"To fix a spaceship while flying","wayback_source":[]}