{"author_link":"\/users\/follett12","author_name":"Follett12","author_uid":"follett12","comments":[],"epoch":1683292792,"event":"LD53","format":"md","ldjam_node_id":369876,"likes":5,"metadata":{"p_key":"200945","p_author":"Follett12","p_authorkey":"1282985","p_urlkey":"433618","p_title":"Blood effects and unitys shader graph","p_cat":"LDJam ","p_event":"LD53","p_time":"1683292792","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":"1282985","us_name":"Follett12","us_username":"follett12","event_start":"1682726400","event_key":"118","event_name":"Ludum Dare 53"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD53","removed_author":false},"_superparent":332127,"_trust":1,"author":282985,"body":"![attack.gif](\/\/\/raw\/961\/54\/z\/5b60f.gif)\n\nSomething I am very proud of from my latest Ludum Dare submission is learning and implementing the Unity Shader Graph tool in URP. I hadn't previously used it and now know its quite good at doing a ton of different effects. \n\nFairly early on I realised I would struggle to show your units health, and stats in the game, and due to the hectic nature once you have a lot of troops it would be almost impossible to micromanage these things.\n\nI was able to implement this fairly simple overlay texture on my sprites which blends based on a float value to add a blood effect to units as their health lowers. I was able to reference this float and use the following code to change the transparency of the texture. \n\n```\n_spriteMat = characterSprite.material;\n_spriteMat.SetFloat(\"_Health\", 1 - (health \/ maxHealth));\n```\n\n![blood.gif](\/\/\/raw\/961\/54\/z\/5b613.gif)\n\nI was able to also use the same idea and implement a flat colour + some lerping of the sprites size to add health, take damage, level up, and join team effects. \n\n![teamup.gif](\/\/\/raw\/961\/54\/z\/5b614.gif)\n\nIf you have any suggestions on what else I could do with this please let me know. Otherwise if you are interested in playing the game check it out here https:\/\/ldjam.com\/events\/ludum-dare\/53\/deliver-the-torch \n","comments":2,"comments-timestamp":"2023-05-05T22:56:12Z","created":"2023-05-05T12:58:32Z","files":[],"files-timestamp":0,"id":369876,"love":5,"love-timestamp":"2023-05-05T15:03:33Z","meta":[],"modified":"2023-05-05T22:56:12Z","name":"Blood effects and unitys shader graph","node-timestamp":"2023-05-05T13:19:52Z","parent":337865,"parents":[1,5,9,332127,337865],"path":"\/events\/ludum-dare\/53\/deliver-the-torch\/blood-effects-and-unitys-shader-graph","published":"2023-05-05T13:19:52Z","scope":"public","slug":"blood-effects-and-unitys-shader-graph","subsubtype":"","subtype":"","type":"post","version":1142365},"node_metadata":{"n_key":"369876","n_urlkey":"433618","n_parent":"337865","n_path":"\/events\/ludum-dare\/53\/deliver-the-torch\/blood-effects-and-unitys-shader-graph","n_slug":"blood-effects-and-unitys-shader-","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"282985","n_created":"1683291512","n_modified":"1683327372","n_version":"1142365","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/53\/deliver-the-torch\/blood-effects-and-unitys-shader-graph","text":"![attack.gif](\/\/\/raw\/961\/54\/z\/5b60f.gif)\n\nSomething I am very proud of from my latest Ludum Dare submission is learning and implementing the Unity Shader Graph tool in URP. I hadn't previously used it and now know its quite good at doing a ton of different effects. \n\nFairly early on I realised I would struggle to show your units health, and stats in the game, and due to the hectic nature once you have a lot of troops it would be almost impossible to micromanage these things.\n\nI was able to implement this fairly simple overlay texture on my sprites which blends based on a float value to add a blood effect to units as their health lowers. I was able to reference this float and use the following code to change the transparency of the texture. \n\n```\n_spriteMat = characterSprite.material;\n_spriteMat.SetFloat(\"_Health\", 1 - (health \/ maxHealth));\n```\n\n![blood.gif](\/\/\/raw\/961\/54\/z\/5b613.gif)\n\nI was able to also use the same idea and implement a flat colour + some lerping of the sprites size to add health, take damage, level up, and join team effects. \n\n![teamup.gif](\/\/\/raw\/961\/54\/z\/5b614.gif)\n\nIf you have any suggestions on what else I could do with this please let me know. Otherwise if you are interested in playing the game check it out here https:\/\/ldjam.com\/events\/ludum-dare\/53\/deliver-the-torch \n","title":"Blood effects and unitys shader graph","wayback_source":[]}