func InitEffect() { Sound("Fire::Fireball", false, 100, nil, nil, nil, 200); Sound("Fire::FuseLoop", false, 20, nil, 1, nil, 200); SetLightRange(30, 70); SetLightColor(RGB(100, 100, 255)); var snow = { R = 200, G = 200, B = 255, Alpha = PV_Linear(255, 0), Size = PV_Random(0, 2), CollisionVertex = 0, OnCollision = PC_Stop(), ForceX = PV_Random(-5, 5, 10), ForceY = PV_Gravity(100), DampingX = 900, DampingY = 900 }; trail_particles = { R = PV_Random(200, 255), G = PV_Random(200, 255), B = 255, Prototype = Particles_FireTrail(), Size = PV_Linear(10, 0), BlitMode = nil, Rotation = PV_Random(0, 360), BlitMode = GFX_BLIT_Additive }; CreateParticle("StarFlash", 0, 0, PV_Random(-30, 30), PV_Random(-30, 30), 100, snow, 100); }
global func Particles_Leaves() { return { Size = PV_Random(3, 6), Phase = PV_Linear(0, 7*5), Alpha = PV_KeyFrames(0, 0, 255, 900, 255, 1000, 0), CollisionVertex = 500, OnCollision = PC_Stop(), ForceX = PV_Wind(100), ForceY = PV_Gravity(40), DampingX = 975, DampingY = 975, Rotation = PV_Direction(PV_Random(750, 1250)), Attach = nil }; }
global func FireBreathEffect(proplist fx, int angle, int distance, int x, int y, int timer) { // calculate velocity and coordinates for the effects var fuzzy = distance / 9; var velocity = distance * 3; var vx = +Sin(angle, velocity); var vy = -Cos(angle, velocity); var vxs = +Sin(angle, 8 * velocity / 10); var vys = -Cos(angle, 8 * velocity / 10); var vx0 = +Sin(angle, velocity / 3); var vy0 = -Cos(angle, velocity / 3); // replace with faster flame if (velocity > fx.spray_old.v1 && fx.spray_cur.reach >= fx.spray_old.reach) { // transfer new values to old values fx.spray_old.reach = fx.spray_cur.reach; fx.spray_old.time = fx.spray_cur.time; fx.spray_old.v0 = fx.spray_cur.v0; fx.spray_old.v1 = fx.spray_cur.v1; fx.spray_old.rmax = fx.spray_cur.rmax; // start a new beam at the beginning fx.spray_cur.reach = 0; fx.spray_cur.time = 0; fx.spray_cur.v0 = velocity / 3; fx.spray_cur.v1 = velocity; fx.spray_cur.rmax = distance * CYCLOPS_FireBreath_Precision; } // calculate position of the flame FireBreathReach(fx.spray_old); FireBreathReach(fx.spray_cur); // particle definitions var smoke = Particles_Smoke(); smoke.ForceX = 0; smoke.ForceY = PV_Gravity(-10); smoke.R = smoke.G = smoke.B = PV_Linear(255, 100); smoke.Size = PV_Linear(5, PV_Random(20, 30)); for (var i = 0; i < RandomX(3, 5); i++) { var scale = 15; var factor = (scale - i); var x0 = x + i * vx0 / 20; var y0 = y + i * vy0 / 20; var vx1 = vx * factor / scale + RandomX(-fuzzy, +fuzzy); var vy1 = vy * factor / scale + RandomX(-fuzzy, +fuzzy); CreateParticle("Fire", x0, y0, PV_Linear(vx0, vx1), PV_Linear(vy0, vy1), PV_Random(30, 40), smoke, 1); } for (var i = 0; i < RandomX(3, 5); i++) { var scale = 15; var factor = (scale - i); var x0 = x + i * vx0 / 20; var y0 = y + i * vy0 / 20; var vxm = vx0 + RandomX(-fuzzy, + fuzzy); var vym = vy0 + RandomX(-fuzzy, + fuzzy); var vx1 = vxs * factor / scale + RandomX(-fuzzy, +fuzzy); var vy1 = vys * factor / scale + RandomX(-fuzzy, +fuzzy); CreateParticle("Fire", x0, y0, PV_Linear(vxm, vx1), PV_Linear(vym, vy1), PV_Random(50, 60), smoke, 1); } }