Advertisement
Tkap1

Untitled

Feb 12th, 2023 (edited)
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // EVERY FRAME
  2. // EVERY FRAME
  3. // EVERY FRAME
  4. // EVERY FRAME
  5.  
  6. struct s_projectile
  7. {
  8.     s_v2 pos;
  9. };
  10. static s_sarray<s_projectile, 1024> projs;
  11. static s_random rng = zero;
  12. if(is_key_pressed(key_space, true))
  13. {
  14.     s_projectile p = zero;
  15.     p.pos.y = rng.randf() * c_world_size.y;
  16.     projs.add(p);
  17. }
  18.  
  19. foreach(proj_i, proj, projs)
  20. {
  21.     s_v2 size = v2(64);
  22.     draw_rect_ui(proj->pos, 0, size, WHITE);
  23.     proj->pos.x += 400 * delta;
  24.     int emitter = make_trigger_altar_particles(&game->ui_particle_emitters, v3(proj->pos + size / 2, -1), null);
  25.     if(proj->pos.x > 2000)
  26.     {
  27.         projs.remove_and_swap(proj_i--);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement