fix vision logic and game tick timer

This commit is contained in:
2025-01-20 11:17:35 +09:00
parent bf38f69071
commit 6b8a220f39
7 changed files with 89 additions and 32 deletions
+18 -5
View File
@@ -11,22 +11,35 @@ export class Dungeon {
game.height = 3000
const playerSpawn = new Vector2(game.width / 2, game.height / 2)
game.spawnEntity(new Entity(Template.player({ id: '1', spawnPosition: playerSpawn, team: Team.blue })))
game.entities.at(0).moveAction(playerSpawn.clone().add(new Vector2(0, -200)))
game.spawnEntity(new Entity(Template.player({ id: '1', spawnPosition: playerSpawn, position: new Vector2(playerSpawn.x - 1300, playerSpawn.y - 500), team: Team.blue })))
const dummyLogic = function dummyLogic() {
if (game.currentTick % (3 * game.tickRate) == 0) {
this.castAction('q', playerSpawn)
const entity = this
if (entity.position.x > 1250) {
entity.moveAction(new Vector2(500, entity.position.y))
}
else if (entity.position.x < 550 || entity.destination == null) {
entity.moveAction(new Vector2(1300, entity.position.y))
}
if (game.currentTick > 0 && game.currentTick % (6 * game.tickRate) == 0) {
entity.castAction('q', playerSpawn)
}
}
const dummy = { radius: 100, visualRadius: 50, abilities: { q: Ability.straightShot.id }, logic: dummyLogic }
game.spawnEntity(new Entity({ ...dummy, position: new Vector2(1 * (game.width / 5), 1 * (game.height / 4)) }))
game.spawnEntity(new Entity({ ...dummy, position: new Vector2(1 * (game.width / 5), 3 * (game.height / 4)) }))
game.addTerrain(new Terrain([
new Vector2(3.5 * (game.width / 10), 1.6 * (game.height / 5)),
new Vector2(3.5 * (game.width / 10), 1.4 * (game.height / 5)),
new Vector2(4 * (game.width / 10), 1.4 * (game.height / 5)),
new Vector2(4 * (game.width / 10), 1.6 * (game.height / 5)),
]))
game.addTerrain(new Terrain([
new Vector2(3 * (game.width / 10), 2 * (game.height / 5)),
new Vector2(3 * (game.width / 10), 1 * (game.height / 5)),
new Vector2(4 * (game.width / 10), 1 * (game.height / 5)),
new Vector2(4 * (game.width / 10), 2 * (game.height / 5)),
]))
], false))
game.start()
}