Browse Source

zig fmt src/

Daniel Sanchez 1 year ago
parent
commit
a318cb650a
3 changed files with 2 additions and 2 deletions
  1. 1 1
      src/Board.zig
  2. 1 1
      src/JS.zig
  3. 0 0
      src/main.zig

+ 1 - 1
src/Board.zig

@@ -72,7 +72,7 @@ pub fn handleCollisions(self: *Self) void {
             return;
             return;
         }
         }
 
 
-        for (self.projectiles.array_list.items) |*projectile, p_i| {
+        for (self.projectiles.array_list.items, 0..) |*projectile, p_i| {
             if (Ball2D.collision(projectile.ball, enemy.ball)) {
             if (Ball2D.collision(projectile.ball, enemy.ball)) {
                 // If a projectile and an enemy collide, we do 3 things:
                 // If a projectile and an enemy collide, we do 3 things:
                 //    * Delete the projectile
                 //    * Delete the projectile

+ 1 - 1
src/JS.zig

@@ -81,7 +81,7 @@ pub const EnemyArrayList = struct {
             const pos = board.getRandomPosition(radius);
             const pos = board.getRandomPosition(radius);
             // New enemies will move towards the current position of the player.
             // New enemies will move towards the current position of the player.
             const vel = Vector2D.direction(player.ball.pos, pos).scalarMultiply(initial_speed);
             const vel = Vector2D.direction(player.ball.pos, pos).scalarMultiply(initial_speed);
-            const color = enemy_colors[@floatToInt(usize, JS.random() * 5)];
+            const color = enemy_colors[@as(usize, @intFromFloat(JS.random() * 5))];
 
 
             const enemy = Enemy.init(pos, vel, radius, color);
             const enemy = Enemy.init(pos, vel, radius, color);
             self.push(game_state, enemy);
             self.push(game_state, enemy);

+ 0 - 0
src/main.zig