42 lines
1.8 KiB
Markdown
42 lines
1.8 KiB
Markdown
# hollow_purple.js — main() (satır 9)
|
||
|
||
[← hollow_purple.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 4/15 · [önceki](main-3.md) · [sonraki](main-5.md)
|
||
|
||
```javascript
|
||
function launchBlockMorph(ctx, morph, sx, sy, sz, vx, vy, vz, life) {
|
||
if (!life) life = 14;
|
||
for (var step = 0; step <= life; step += 2) {
|
||
(function(tt) {
|
||
ctx.scheduleScript(tt, function(c2) {
|
||
c2.getWorld().displayMorph(morph, 3,
|
||
sx + vx * tt,
|
||
sy + vy * tt - 0.045 * tt * tt,
|
||
sz + vz * tt,
|
||
tt * 24, tt * 16, 80, null);
|
||
});
|
||
})(step);
|
||
}
|
||
}
|
||
|
||
// ---------- Yardımcı: küresel enkaz patlaması ----------
|
||
function blastDebris(ctx, ox, oy, oz, count, power, life) {
|
||
for (var d = 0; d < count; d++) {
|
||
var theta = Math.random() * Math.PI * 2;
|
||
var phi = Math.acos(2 * Math.random() - 1);
|
||
var spd = power * (0.4 + Math.random() * 0.6);
|
||
launchBlockMorph(ctx, debrisMorphs[d % debrisMorphs.length], ox, oy, oz,
|
||
Math.sin(phi) * Math.cos(theta) * spd,
|
||
Math.abs(Math.cos(phi)) * spd * 0.7 + 0.3,
|
||
Math.sin(phi) * Math.sin(theta) * spd, life);
|
||
}
|
||
}
|
||
|
||
// ---------- Yardımcı: genişleyen şok dalgası ----------
|
||
function shockwaveRing(ctx, ox, oy, oz, morph, maxR, ticks) {
|
||
for (var st = 0; st < ticks; st++) {
|
||
(function(stt) {
|
||
ctx.scheduleScript(stt, function(c2) {
|
||
```
|