mirror of
https://github.com/Sheldan/canvas.git
synced 2026-07-10 17:03:37 +00:00
survivors: adding functional container enemy with random chances on death
split between create and spawn methods adding level drop adding ability to player to level fixing hud not showing the label value adding current level display to hud adding ability to weapons to level
This commit is contained in:
@@ -4,7 +4,7 @@ import {docReady} from "canvas-common";
|
||||
import {World} from "./World.ts";
|
||||
import {Player} from "./Player.ts";
|
||||
import {Vector} from "./base.ts";
|
||||
import {BasicEnemy, Enemy, HealthEnemy, ShootingEnemy} from "./Enemies.ts";
|
||||
import {BasicEnemy, ContainerEnemy, Enemy, HealthEnemy, ShootingEnemy} from "./Enemies.ts";
|
||||
import {HUD} from "./ui.ts";
|
||||
import {HomingPistol, Pistol} from "./weapons.ts";
|
||||
|
||||
@@ -107,18 +107,22 @@ docReady(function () {
|
||||
world = new World(player, ctx, new Vector(window.innerWidth, window.innerHeight));
|
||||
state = new WorldState();
|
||||
|
||||
world.addEnemy(BasicEnemy.generateBasicEnemy(world))
|
||||
world.addEnemy(ShootingEnemy.generateShootingEnemy(world, new Vector(350, 350)))
|
||||
BasicEnemy.spawnBasicEnemy(world)
|
||||
ShootingEnemy.spawnShootingEnemy(world, new Vector(350, 350))
|
||||
setInterval(() => {
|
||||
world.addEnemy(ShootingEnemy.generateShootingEnemy(world))
|
||||
ShootingEnemy.spawnShootingEnemy(world)
|
||||
}, 1_000)
|
||||
|
||||
setInterval(() => {
|
||||
world.addEnemy(HealthEnemy.createHealthEnemy(world))
|
||||
HealthEnemy.spawnHealthEnemy(world)
|
||||
}, 15_000)
|
||||
|
||||
player.addWeapon(Pistol.spawnPistol(world))
|
||||
player.addWeapon(HomingPistol.spawnPistol(world))
|
||||
setInterval(() => {
|
||||
ContainerEnemy.spawnContainerEnemy(world)
|
||||
}, 10_000)
|
||||
|
||||
player.addWeapon(Pistol.generatePistol(world))
|
||||
player.addWeapon(HomingPistol.generatePistol(world))
|
||||
hud = new HUD(world);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user