Skip to content

Commit

Permalink
update gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
stutxo committed Apr 7, 2024
1 parent bda118c commit b14f147
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h1 style="text-align: center; color: #333;">blockwars.gg</h1>
<script>
//This is a base64 encoded WebAssembly binary, it is 33% bigger than the original .wasm binary, im just testing it out.
// Base64WasmStart
const base64Wasm = 'AGFzbQEAAAABEANgAABgBH19f38AYAF/AX8DBAMAAQIFAwEAFAY5B38BQYCAwAALfwBBlIPAAAt/AEGRg8AAC38AQZCDwAALfwBBmPPPAAt/AEGY9M8AC38AQaD0zwALB08IBm1lbW9yeQIACWJsb2Nrd2FycwAABERSQVcDAQVSRVNFVAMCBUlOUFVUAwMEU0VFRAMECl9fZGF0YV9lbmQDBQtfX2hlYXBfYmFzZQMGCukRA88NAgl/Cn0jAEGAAWsiByQAQfyPcCEAA0AgAARAIABBmPPPAGpBADYCACAAQQRqIQAMAQsLQQAhAAJAQZGDwAAtAABBAUYEQEGQg8AAQQA6AABBkYPAAEEAOgAAIAcQAiIEKAJ8IARB+ABqIgUoAgBzIgZBB3BBA2ohASAEIQICQANAIAEgA0YEQCAGQQR0IAZBB25B8ABsa0GwgMAAaiEAA0AgAUEJSw0DIABBADYCACAAQRBqIQAgAUEBaiEBDAALAAsgAEGgAUcEQCAAQYCAQGtBATYCACAAQYyAwABqQwAAAEBDAABAQCAAQRBGG0MAAIA/IAAbOAIAIABBiIDAAGogAigCACIIIAUoAgBzQfoBcLM4AgAgAEGEgMAAaiAIIAQgA0Efc0ECdGooAgBzQfUBcLM4AgAgBUEEayEFIAJBBGohAiAAQRBqIQAgA0EBaiEDDAELCwNADAALAAsgBBACIgJB+ABqIQFBkH4hACACIgMoAnwhBkEAIQUDQCAARQ0CIABBnIPAAGpBADYCACAAQZiDwABqIAMoAgAiBCAGc0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PPAGoiAUEDcQRAIAZBAEwNASABQQN0IgdBGHEhCSABQXxxIgVBBGohAkEAIAdrQRhxIQcgBSgCACEFA0AgBCAFIAl2IAIoAgAiBSAHdHI2AgAgAkEEaiECIARBBGoiBCADSQ0ACwwBCyAGQQBMDQAgASECA0AgBCACKAIANgIAIAJBBGohAiAEQQRqIgQgA0kNAAsLIAEgBmohAiAIQQNxIgEEQCABIANqIQEDQCADIAItAAA6AAAgAkEBaiECIANBAWoiAyABSQ0ACwsgAAs=';
// Base64WasmEnd
const canvas = document.getElementById('canvas');

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HEIGHT: u8 = 255;

const MAX_TELEPORT: usize = 10;
const TELEPORT_SIZE: u8 = 5;
const TELEPORT_SPEED: f32 = 15.;
const TELEPORT_SPEED: f32 = 10.;

const TELEPORT_NONE: core::option::Option<(f32, f32, f32)> = None;
static mut TELEPORT: [Option<(f32, f32, f32)>; MAX_TELEPORT] = [TELEPORT_NONE; MAX_TELEPORT];
Expand Down Expand Up @@ -117,15 +117,15 @@ fn spawn_enemy(enemies: &mut [(f32, f32, f32, f32); MAX_ENEMY], rng: [u32; 32])
let raw_random_value = rng[i] ^ rng[31];
let scaled_random_value = (raw_random_value % 5) + 1;

enemies[i] = (x as f32, y as f32, scaled_random_value as f32, 0.);
enemies[i] = (x as f32, y as f32, scaled_random_value as f32, 10.);
}
}

#[inline]
fn move_enemy(enemies: &mut [(f32, f32, f32, f32); MAX_ENEMY]) {
for enemy in enemies.iter_mut() {
let (x, y, state, count) = enemy;
let movement_count = 30.0; // Number of steps to move in one direction
let movement_count = 50.0; // Number of steps to move in one direction

if *count >= movement_count {
*state = match *state {
Expand Down

0 comments on commit b14f147

Please sign in to comment.