more TODO

This commit is contained in:
Thomas von Dein 2024-02-26 14:43:03 +01:00
parent 8f0fb746c0
commit 0ca5d8f4a0
4 changed files with 40 additions and 29 deletions

49
TODO.md
View File

@ -1,9 +1,10 @@
## Levels:
- use first line as background image name
- ignore comments in lvl files
- check when sphere bounces from one end to the other endlessly w/o
any solids in between. this is a game lock and equals game over
- Start the game end timer and add a score FIXME: put the actual max
reachable score into the level definition along with the minimum
steps required to reach it, also add a step counter
@ -11,31 +12,35 @@
- Grid Observer:
https://github.com/mlange-42/arche/issues/374
Screenshot:
Yes, since *ebiten.Image implements the standard image.Image interface
I just made a screenshot example (in Draw() function):
if inpututil.IsKeyJustPressed(ebiten.KeyS) {
f, err := os.Create("screenshot.png")
if err != nil {
log.Fatal("can't create file: ", err)
}
png.Encode(f, screen)
}
- Add some final message when the player reaches the last level, start
from scratch or a message to buy me some beer, whatever
- Calculate obstacle collision the same as solid collision with future
velocity and included snap in so that the player ends up right on
the edge of the obstacle and not inside as it is now
- Check player-player collisions!
- Do all collision detections in ONE system
- Add player mergers, possibly as an option, so maybe we could have
different primary and secondary players: one pair can merge, the
other not. Like S + s and M + m or something.
- Add shaders for animation (player destruction etc)
- Add player HUD + Stats (as hud_system!)
## Collider Rework
- do not use the map anymore for collision detection
- check swept AABB instead of my collision detection, to allow for higher speeds
- central collision_system
- add Collider component with callback funcs to call on certain events
- callback types:
- rect intersect (== future collision)
- collision resolve (set new position)
- pass over foreign rect (to e.g. change sprite while flying over sprite)
- pass over done (switch sprite)
- check for all moving objects against non-moving ones like moving
obstacle, player, bullet, laser
- check if executing callbacks within query loop is allowed
- callback function needs to be able to modify other components, so
possibly use observers for them, e.g.:
Collider.IntersectResolve => func(newpos) {player.pos = newpos; player.vel = stop}
- in the end it must be possible to add new entities without the need
to write a collision check for them, but have collision detection anyway!

BIN
assets/sprites/hud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -8,7 +8,6 @@ import (
"openquell/observers"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
"github.com/mlange-42/arche/ecs"
)
@ -119,13 +118,7 @@ func (game *Game) Update() error {
}
func (game *Game) Draw(screen *ebiten.Image) {
//slog.Debug("FPS", "fps", ebiten.ActualFPS())
game.GetCurrentScene().Draw(screen)
ebitenutil.DebugPrintAt(screen, fmt.Sprintf(
"FPS: %02.f TPS: %02.f",
ebiten.ActualFPS(),
ebiten.ActualTPS(),
), 0, 0)
}
func (g *Game) Layout(newWidth, newHeight int) (int, int) {

View File

@ -1,10 +1,12 @@
package game
import (
"fmt"
"log/slog"
"openquell/assets"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
)
type LevelScene struct {
@ -69,12 +71,23 @@ func (scene *LevelScene) Update() error {
}
func (scene *LevelScene) Draw(screen *ebiten.Image) {
// FIXME: why not in Update() ?!?!?!
if scene.CurrentLevel != scene.Game.Observer.CurrentLevel {
slog.Debug("level", "current", scene.CurrentLevel,
"next", scene.Game.Observer.CurrentLevel)
scene.CurrentLevel = scene.Game.Observer.CurrentLevel
scene.Levels[scene.CurrentLevel].SetupGrid(scene.Game)
}
screen.Clear()
scene.Levels[scene.CurrentLevel].Draw(screen)
// FIXME: put into hud_system
op := &ebiten.DrawImageOptions{}
screen.DrawImage(assets.Assets["hud"], op)
ebitenutil.DebugPrintAt(screen, fmt.Sprintf(
"FPS: %02.f TPS: %02.f",
ebiten.ActualFPS(),
ebiten.ActualTPS(),
), 10, 10)
}