fixed player loop detection, added more levels

This commit is contained in:
Thomas von Dein 2024-03-21 19:04:47 +01:00
parent 19c9a5d502
commit 51d3776abf
4 changed files with 1807 additions and 19 deletions

View File

@ -24,7 +24,10 @@
- Turn menu button in hud_system (events in level_scene!) into ebitenui button
- Obstacle don't stop at collectibles
- Player can collect collectible hidden under obstacle (should be
fixed when above is fixed)
## Collider Rework [abandoned: see branch collider-system, fails]

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ const (
const PLAYERSPEED int = 5
const PARTICLE_LOOPWAIT time.Duration = 250 * time.Millisecond
const LEVEL_END_WAIT time.Duration = 500 * time.Millisecond
const version string = "1.2.0"
const version string = "1.2.1"
const MenuRectX int = 600
const MenuRectY int = 0

View File

@ -77,10 +77,16 @@ func (system PlayerSystem) Update() error {
if count > 1 {
// check if player collides with another player, fuse them if any
EntitiesToRemove = system.CheckPlayerCollision(playerposition, velocity, query.Entity())
if len(EntitiesToRemove) > 0 {
slog.Debug("other player collision")
}
} else {
// only 1 player left or one is max
EntitiesToRemove = system.CheckPlayerLooping(
playerposition, velocity, player, query.Entity())
if len(EntitiesToRemove) > 0 {
slog.Debug("player loops", "entities", EntitiesToRemove)
}
}
if !velocity.Moving() {
@ -250,8 +256,11 @@ func (system *PlayerSystem) CheckPlayerLooping(
max = system.Height
}
max += system.GridContainer.Grid.Tilesize * 5
// we haved moved one time around the whole screen, loose
if (player.LoopCount * velocity.Speed) > max {
slog.Debug("loop?", "loopcount", player.LoopCount, "speed", velocity.Speed, "max", max)
EntitiesToRemove = append(EntitiesToRemove, entity)
}
}