Ostatnio aktywny 1734936030

old-bullet-move.nv Surowy Playground
1|#port, on move bullets, needs, @move bullets|
2|#port body, on move bullets, lua|
3 local dt = state.dt
4 local bullets = state.bullets
5 for _, bullet in ipairs(bullets) do
6 if not (bullet.frozen and counters["game is paused"] > 0) then
7 bullet.frozen = false
8 bullet.x = bullet.x + math.cos(bullet.angle) * 350 * dt
9 bullet.y = bullet.y + math.sin(bullet.angle) * 350 * dt
10 local in_bounds
11 = -10 <= bullet.x and bullet.x <= 810
12 and -10 <= bullet.y and bullet.y <= 610
13 if not in_bounds then
14 bullet.deleted = true
15 end
16 end
17 end
split-apart-bullet-move.nv Surowy Playground
1|#port, on move bullet, needs, @move bullet, reads, @bullet index|
2|#port body, on move bullet, lua|
3 local dt = state.dt
4 local bullet = state.bullets[bullet_index]
5 bullet.x = bullet.x + math.cos(bullet.angle) * 350 * dt
6 bullet.y = bullet.y + math.sin(bullet.angle) * 350 * dt
7
8|#port, on is bullet fronze, needs, @is bullet frozen, reads, @bullet index|
9 @bullet is frozen
10|#port body, on is bullet frozen, lua|
11 counters["bullet is frozen"] = state.bullets[bullet_index].frozen and 1 or 0
12
13|#port, on is bullet out of bounds
14 , needs, @is bullet out of bounds
15 , reads, @bullet index|
16 @bullet is out of bounds
17|#port body, on is bullet out of bounds, lua|
18 local bullet = state.bullets[bullet_index]
19 local in_bounds
20 = -10 <= bullet.x and bullet.x <= 810
21 and -10 <= bullet.y and bullet.y <= 610
22 counters["@bullet is out of bounds"] = in_bounds and 1 or 0
23
24|#port, on mark bullet for deletion
25 , needs, @mark bullet for deletion
26 , reads, @bullet index|
27|#port body, on mark bullet for deletion, lua|
28 local bullet = state.bullets[bullet_index]
29 bullet.deleted = true