Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame] | 1 | { |
| 2 | "MaxCount": 32, |
Brian Osman | 543d2e2 | 2019-02-15 14:29:38 -0500 | [diff] [blame] | 3 | "Drawable": { |
| 4 | "Type": "SkImageDrawable", |
Brian Osman | d12f278 | 2019-11-27 10:34:18 -0500 | [diff] [blame] | 5 | "Path": "images", |
| 6 | "Name": "explosion_sprites.png", |
Brian Osman | 543d2e2 | 2019-02-15 14:29:38 -0500 | [diff] [blame] | 7 | "Columns": 4, |
| 8 | "Rows": 4 |
Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame] | 9 | }, |
Brian Osman | d46cb97 | 2019-09-12 16:25:52 -0400 | [diff] [blame] | 10 | "EffectCode": [ |
| 11 | "void effectSpawn(inout Effect effect) {", |
| 12 | " effect.rate = 8;", |
| 13 | "}", |
Brian Osman | d46cb97 | 2019-09-12 16:25:52 -0400 | [diff] [blame] | 14 | "" |
| 15 | ], |
| 16 | "Code": [ |
Brian Osman | 95c26ef | 2020-02-10 13:45:22 -0500 | [diff] [blame] | 17 | "float2 circle(inout uint seed) {", |
Brian Osman | d6108ad | 2019-07-25 16:27:35 -0400 | [diff] [blame] | 18 | " float x;", |
| 19 | " float y;", |
| 20 | " do {", |
Brian Osman | 95c26ef | 2020-02-10 13:45:22 -0500 | [diff] [blame] | 21 | " x = rand(seed) * 2 - 1;", |
| 22 | " y = rand(seed) * 2 - 1;", |
Brian Osman | d6108ad | 2019-07-25 16:27:35 -0400 | [diff] [blame] | 23 | " } while (x*x + y*y > 1);", |
| 24 | " return float2(x, y);", |
| 25 | "}", |
| 26 | "", |
Brian Osman | e59acb7 | 2019-07-25 16:58:46 -0400 | [diff] [blame] | 27 | "void spawn(inout Particle p) {", |
Brian Osman | 95c26ef | 2020-02-10 13:45:22 -0500 | [diff] [blame] | 28 | " p.lifetime = 1.0 + rand(p.seed) * 2.0;", |
| 29 | " float2 ofs = circle(p.seed) * 60;", |
Brian Osman | df18296 | 2019-10-15 10:27:59 -0400 | [diff] [blame] | 30 | " p.pos += ofs;", |
| 31 | " p.vel = ofs / 3;", |
Brian Osman | d6108ad | 2019-07-25 16:27:35 -0400 | [diff] [blame] | 32 | "}", |
Brian Osman | d6108ad | 2019-07-25 16:27:35 -0400 | [diff] [blame] | 33 | "", |
Brian Osman | e59acb7 | 2019-07-25 16:58:46 -0400 | [diff] [blame] | 34 | "void update(inout Particle p) {", |
Brian Osman | d6108ad | 2019-07-25 16:27:35 -0400 | [diff] [blame] | 35 | " p.frame = p.age;", |
| 36 | "}", |
| 37 | "" |
| 38 | ], |
Brian Osman | fe49163 | 2019-07-25 15:14:50 -0400 | [diff] [blame] | 39 | "Bindings": [] |
Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame] | 40 | } |