mirror of
https://github.com/He4eT/DotDashPit.git
synced 2026-05-04 17:37:23 +00:00
game: make the start more friendly
This commit is contained in:
parent
4a47806c80
commit
7862061d93
1 changed files with 12 additions and 4 deletions
16
game.js
16
game.js
|
|
@ -9,7 +9,7 @@
|
||||||
// version: 1.0
|
// version: 1.0
|
||||||
|
|
||||||
const DOT_DASH_THRESHOLD = 200
|
const DOT_DASH_THRESHOLD = 200
|
||||||
const DOT_DASH_IDLE_TIMEOUT = 500
|
const DOT_DASH_IDLE_TIMEOUT = 450
|
||||||
|
|
||||||
const FONT_SIZE = 1
|
const FONT_SIZE = 1
|
||||||
const HINT_DISTANCE = 30
|
const HINT_DISTANCE = 30
|
||||||
|
|
@ -356,12 +356,20 @@ function spawnEnemies() {
|
||||||
const enemyCount = 1 + Math.floor(arena.wave / 2)
|
const enemyCount = 1 + Math.floor(arena.wave / 2)
|
||||||
|
|
||||||
const getType = (wave) => {
|
const getType = (wave) => {
|
||||||
if (wave <= 2) return 'point'
|
|
||||||
|
|
||||||
const availableTypes = Object.keys(enemyBlueprints)
|
const availableTypes = Object.keys(enemyBlueprints)
|
||||||
|
|
||||||
|
if (wave <= 2) return availableTypes[0]
|
||||||
|
if (wave <= 6) return availableTypes[wave - 2]
|
||||||
|
|
||||||
return availableTypes[rnd(0, availableTypes.length - 1)]
|
return availableTypes[rnd(0, availableTypes.length - 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getSpeed = (type, wave) => {
|
||||||
|
if (wave <= 6) return 0.3
|
||||||
|
|
||||||
|
return enemyBlueprints[type].maxSpeed * Math.random()
|
||||||
|
}
|
||||||
|
|
||||||
const getSpawnPosition = (type) => {
|
const getSpawnPosition = (type) => {
|
||||||
const minDistance = enemyBlueprints[type].spawnDistance
|
const minDistance = enemyBlueprints[type].spawnDistance
|
||||||
const b = 4 * SPRITE_RADIUS
|
const b = 4 * SPRITE_RADIUS
|
||||||
|
|
@ -380,7 +388,7 @@ function spawnEnemies() {
|
||||||
const type = getType(arena.wave)
|
const type = getType(arena.wave)
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
speed: enemyBlueprints[type].maxSpeed * Math.random(),
|
speed: getSpeed(type, arena.wave),
|
||||||
value: enemyBlueprints[type].value,
|
value: enemyBlueprints[type].value,
|
||||||
letter: alphabet[rnd(0, alphabet.length - 1)],
|
letter: alphabet[rnd(0, alphabet.length - 1)],
|
||||||
positions: [getSpawnPosition(type), getSpawnPosition(type)],
|
positions: [getSpawnPosition(type), getSpawnPosition(type)],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue