Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 35 | chris | 1 | unit app_particle_crystalshards; |
| 2 | |||
| 3 | interface |
||
| 4 | |||
| 5 | uses sux_constant, sux_object, app_constant, resource_texture, |
||
| 6 | resource_list, app_particle_main, app_particle_part; |
||
| 7 | |||
| 8 | type |
||
| 9 | TShards=record |
||
| 10 | end; |
||
| 11 | SAPCrystalShards=class(SAParticle) |
||
| 12 | shards: TShards; |
||
| 13 | |||
| 14 | procedure createShards(const pos: SXVertex2D; const texture: SRTexture); |
||
| 15 | |||
| 16 | procedure onTimer; override; |
||
| 17 | |||
| 18 | procedure initialize; override; |
||
| 19 | constructor Create(const parent: TObject); |
||
| 20 | destructor Destroy; override; |
||
| 21 | end; |
||
| 22 | |||
| 23 | implementation |
||
| 24 | |||
| 25 | uses main, gl_main, OpenGL; |
||
| 26 | |||
| 27 | |||
| 28 | // --- SAPCrystalShards |
||
| 29 | |||
| 30 | |||
| 31 | procedure SAPCrystalShards.createShards(const pos: SXVertex2D; const texture: SRTexture); |
||
| 32 | var p: SXInt; |
||
| 33 | part: SAPPart; |
||
| 34 | partpos: SXVertex2D; |
||
| 35 | partmove: SXVertex2D; |
||
| 36 | partrot: SXFloat; |
||
| 37 | begin |
||
| 38 | settings.texture := texture; |
||
| 39 | for p := 0 to 8 do |
||
| 40 | begin |
||
| 41 | partpos.x := pos.x + sx.math.random.getRandomFloat(-15, 15); |
||
| 42 | partpos.y := pos.y + sx.math.random.getRandomFloat(-15, 15); |
||
| 43 | partrot := sx.math.random.getRandomFloat(0, 360); |
||
| 44 | part := addParticle(0, partpos, partrot, sx.math.random.getRandomFloat(3, 10)); |
||
| 45 | part.setDensity(1.0); |
||
| 46 | |||
| 47 | partmove.x := sx.math._sin(partrot); |
||
| 48 | partmove.y := sx.math._cos(partrot); |
||
| 49 | partmove := sx.math.multiplyVertex(partmove, sx.math.random.getRandomFloat(10, 60)); |
||
| 50 | |||
| 51 | part.setAnimation(partmove, sx.math.random.getRandomFloat(-400, 400), 0, |
||
| 52 | sx.convert.ColorRGBOf(0, 0, 0), -0.6); |
||
| 53 | end; |
||
| 54 | end; |
||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | procedure SAPCrystalShards.onTimer; |
||
| 60 | begin |
||
| 61 | onTimerParts; |
||
| 62 | deleteIfEmpty; |
||
| 63 | end; |
||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | procedure SAPCrystalShards.initialize; |
||
| 69 | begin |
||
| 70 | end; |
||
| 71 | |||
| 72 | |||
| 73 | constructor SAPCrystalShards.Create(const parent: TObject); |
||
| 74 | begin |
||
| 75 | inherited Create(parent); |
||
| 76 | |||
| 77 | setupAppearance(nil, 1); |
||
| 78 | setBlending(SX_GL_BLEND_AVERAGE); |
||
| 79 | end; |
||
| 80 | |||
| 81 | |||
| 82 | destructor SAPCrystalShards.Destroy; |
||
| 83 | begin |
||
| 84 | inherited; |
||
| 85 | end; |
||
| 86 | |||
| 87 | |||
| 88 | end. |