Skip to content

Commit

Permalink
make it harder
Browse files Browse the repository at this point in the history
  • Loading branch information
stutxo committed Mar 28, 2024
1 parent 930b418 commit e091935
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Binary file modified docs/blockwars.wasm
Binary file not shown.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ static FRAME: AtomicU32 = AtomicU32::new(0);
const WIDTH: usize = 800;
const HEIGHT: usize = 800;
const PLAYER_SPEED: usize = 2;
const ENEMY_SIZE: usize = 15;
const ENEMY_SIZE: usize = 5;
const PLAYER_SIZE: usize = 10;
const WALL_SIZE: usize = 3;
const SEED: u32 = 0x1337;
const SEED: u32 = 0x1331;

static mut GAME_OVER: bool = false;

Expand All @@ -26,7 +26,7 @@ pub unsafe extern "C" fn game_loop() -> u32 {
}
}

const MAX_ENEMIES: usize = 600;
const MAX_ENEMIES: usize = 2000;
const ENEMIES_NONE: core::option::Option<Enemy> = None;
static mut ENEMIES: [Option<Enemy>; MAX_ENEMIES] = [ENEMIES_NONE; MAX_ENEMIES];
struct Enemy {
Expand Down Expand Up @@ -106,7 +106,7 @@ impl Rng {

#[no_mangle]
pub extern "C" fn spawn() {
for _ in 0..21 {
for _ in 0..50 {
spawn_enemy();
}

Expand Down Expand Up @@ -236,10 +236,10 @@ fn update_enemy_pos() {
enemy.y += 1;
}

if (enemy.x >= player.x - PLAYER_SIZE
&& enemy.x <= player.x + PLAYER_SIZE)
&& (enemy.y >= player.y - PLAYER_SIZE
&& enemy.y <= player.y + PLAYER_SIZE)
if (enemy.x >= player.x - ENEMY_SIZE
&& enemy.x <= player.x + ENEMY_SIZE)
&& (enemy.y >= player.y - ENEMY_SIZE
&& enemy.y <= player.y + ENEMY_SIZE)
{
GAME_OVER = true;
}
Expand Down

0 comments on commit e091935

Please sign in to comment.