spinners and gems
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// Built-in script for the `gem` archetype (see kiln-core/src/builtin_scripts.rs).
|
||||
//
|
||||
// A gem is a grabbable collectible: walking onto it (or pushing it into the
|
||||
// player) fires this `grab()` hook instead of blocking. We bump the player's gem
|
||||
// count and remove ourselves from the board.
|
||||
fn grab() {
|
||||
add_gems(1);
|
||||
die();
|
||||
}
|
||||
@@ -68,9 +68,15 @@ fn tick(dt) {
|
||||
let changed = false;
|
||||
for i in 0..8 {
|
||||
let n = (i + step) % 8;
|
||||
let pn = (i + step - 1) % 8;
|
||||
let dx = ox + ring[n][0];
|
||||
let dy = oy + ring[n][1];
|
||||
if moves[i] && !passable(dx, dy) && !moves[n] {
|
||||
let sx = ox + ring[pn][0];
|
||||
let sy = oy + ring[pn][1];
|
||||
|
||||
let blocked = !passable(dx, dy) && !combinable(sx, sy, dx, dy);
|
||||
|
||||
if moves[i] && blocked && !moves[n] {
|
||||
moves[i] = false;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user