You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
export const BLOCK_SIZE = 32 // each block is 32̨̣̌̇x32 pixel in size and equals 1m
|
|
export const RECIPROCAL = 1 / BLOCK_SIZE
|
|
|
|
export const STAGE_WIDTH = 32 // 32*32 = 1024 pixel wide stage
|
|
export const STAGE_HEIGHT = ~~(STAGE_WIDTH * 0.5625) // 16:9 😎
|
|
|
|
// the player position is fixed to the middle of the x axis
|
|
export const PLAYER_X = ~~(STAGE_WIDTH / 2) + 1
|
|
export const PLAYER_Y = ~~(STAGE_HEIGHT * 0.5) // fall from the center
|
|
|
|
export const GRAVITY = 10 // blocks per second
|
|
|
|
export type Block = {
|
|
type: string,
|
|
hp: number,
|
|
walkable: boolean,
|
|
climbable?: boolean,
|
|
}
|
|
|
|
export const blockTypes: Record<string, Block> = {
|
|
air: { type: 'air', hp: Infinity, walkable: true },
|
|
grass: { type: 'grass', hp: 1, walkable: false },
|
|
|
|
treeTopLeft: { type: 'treeTopLeft', hp: 5, walkable: true },
|
|
treeTopMiddle: { type: 'treeTopMiddle', hp: 5, walkable: true },
|
|
treeTopRight: { type: 'treeTopRight', hp: 5, walkable: true },
|
|
|
|
treeCrownLeft: { type: 'treeCrownLeft', hp: 5, walkable: true },
|
|
treeCrownMiddle: { type: 'treeCrownMiddle', hp: 5, walkable: true, climbable: true },
|
|
treeCrownRight: { type: 'treeCrownRight', hp: 5, walkable: true },
|
|
|
|
treeTrunkLeft: { type: 'treeTrunkLeft', hp: 5, walkable: true },
|
|
treeTrunkMiddle: { type: 'treeTrunkMiddle', hp: 5, walkable: true, climbable: true },
|
|
treeTrunkRight: { type: 'treeTrunkRight', hp: 5, walkable: true },
|
|
|
|
treeRootLeft: { type: 'treeRootLeft', hp: 5, walkable: true },
|
|
treeRootMiddle: { type: 'treeRootMiddle', hp: 5, walkable: true, climbable: true },
|
|
treeRootRight: { type: 'treeRootRight', hp: 5, walkable: true },
|
|
|
|
treeTopLeftMixed: { type: 'treeTopLeftMixed', hp: 5, walkable: true },
|
|
treeCrownLeftMixed: { type: 'treeCrownLeftMixed', hp: 5, walkable: true },
|
|
treeTrunkLeftMixed: { type: 'treeTrunkLeftMixed', hp: 5, walkable: true },
|
|
treeRootLeftMixed: { type: 'treeRootLeftMixed', hp: 5, walkable: true },
|
|
|
|
treeTopRightMixed: { type: 'treeTopRightMixed', hp: 5, walkable: true },
|
|
treeCrownRightMixed: { type: 'treeCrownRightMixed', hp: 5, walkable: true },
|
|
treeTrunkRightMixed: { type: 'treeTrunkRightMixed', hp: 5, walkable: true },
|
|
treeRootRightMixed: { type: 'treeRootRightMixed', hp: 5, walkable: true },
|
|
|
|
soil: { type: 'soil', hp: 2, walkable: false },
|
|
soilGravel: { type: 'soilGravel', hp: 5, walkable: false },
|
|
stoneGravel: { type: 'stoneGravel', hp: 5, walkable: false },
|
|
stone: { type: 'stone', hp: 10, walkable: false },
|
|
bedrock: { type: 'bedrock', hp: 25, walkable: false },
|
|
cave: { type: 'cave', hp: Infinity, walkable: true },
|
|
}
|
|
|
|
export const level = {
|
|
treeTop: 24,
|
|
ground: 28,
|
|
rock: 32,
|
|
underground: 48,
|
|
caveMax: 250,
|
|
}
|
|
|
|
export const probability = {
|
|
tree: 0.2,
|
|
soilHole: 0.3,
|
|
soilGravel: 0.2,
|
|
stoneGravel: 0.1,
|
|
cave: 0.5,
|
|
fray: 0.4,
|
|
}
|