Collision now uses bits and masks. The main upshot is that ghost and ice/directional blocks collide much more correctly, now. And turtles block fireballs. Also, monsters can now move over "no" signs, and can trample the player if she's standing on top of an item. While I was at it, I finished implementing the "bestowal bow", an item mod (same layer as the "no" sign) that allows any actor to pick up the item in that tile.
69 lines
1.6 KiB
JavaScript
69 lines
1.6 KiB
JavaScript
export const TICS_PER_SECOND = 20;
|
|
|
|
export const DIRECTIONS = {
|
|
north: {
|
|
movement: [0, -1],
|
|
bit: 0x01,
|
|
action: 'up',
|
|
left: 'west',
|
|
right: 'east',
|
|
opposite: 'south',
|
|
},
|
|
south: {
|
|
movement: [0, 1],
|
|
bit: 0x04,
|
|
action: 'down',
|
|
left: 'east',
|
|
right: 'west',
|
|
opposite: 'north',
|
|
},
|
|
west: {
|
|
movement: [-1, 0],
|
|
bit: 0x08,
|
|
action: 'left',
|
|
left: 'south',
|
|
right: 'north',
|
|
opposite: 'east',
|
|
},
|
|
east: {
|
|
movement: [1, 0],
|
|
bit: 0x02,
|
|
action: 'right',
|
|
left: 'north',
|
|
right: 'south',
|
|
opposite: 'west',
|
|
},
|
|
};
|
|
|
|
// TODO cc2 order is: swivel, thinwalls, canopy (and yes you can have them all in the same tile)
|
|
export const DRAW_LAYERS = {
|
|
terrain: 0,
|
|
item: 1,
|
|
item_mod: 2,
|
|
actor: 3,
|
|
overlay: 4,
|
|
MAX: 5,
|
|
};
|
|
|
|
export const COLLISION = {
|
|
player1: 0x0001,
|
|
player2: 0x0002,
|
|
player: 0x0003,
|
|
|
|
block_cc1: 0x0004,
|
|
block_cc2: 0x0008, // ice + directional
|
|
|
|
// NOTE: "monster" does NOT include ghost, because it so rarely overlaps anything else
|
|
monster: 0x0100,
|
|
// Some monsters also have their own extra flag because of weird behavior
|
|
fireball: 0x0200,
|
|
bug: 0x0400,
|
|
rover: 0x1000,
|
|
ghost: 0x8000,
|
|
|
|
// Combo masks used for matching
|
|
all_but_ghost: 0xffff & ~0x8000,
|
|
all_but_player: 0xffff & ~0x0003,
|
|
all: 0xffff,
|
|
};
|