Added proper taggins for gravity

This commit is contained in:
2025-11-26 00:27:28 -07:00
parent a9b2a3b7ff
commit c70f85abe5
4 changed files with 118 additions and 24 deletions

View File

@@ -52,7 +52,7 @@ type GameplayScreen struct {
func NewGameplayScreen(screenWidth, screenHeight int, mapManager *maps.Manager, fpsEnabled *bool, portalVisibility *bool) *GameplayScreen {
cfg := config.Default()
// Ensure we have a current map
if mapManager.CurrentMap() == nil {
// Fallback or error later
@@ -119,7 +119,7 @@ func (g *GameplayScreen) Update(input GameplayInput, delta time.Duration) {
Right: input.Right,
Jump: input.Jump,
Sprint: input.Sprint,
}, dt, g.bounds)
}, dt, g.bounds, g.world)
if input.Shoot {
direction := 1.0
@@ -224,7 +224,7 @@ func (g *GameplayScreen) trackFPS(delta time.Duration) {
// Rendering
func (g *GameplayScreen) Draw(screen *ebiten.Image) {
cfg := config.Default()
currentMap := g.mapManager.CurrentMap()
if currentMap != nil {
currentMap.Draw(screen)
@@ -381,12 +381,12 @@ func (g *GameplayScreen) LoadState(state *save.GameState) {
screenHeight := int(g.bounds.Height)
g.mapManager.Reset()
mapID := state.CurrentMap
if mapID == "" {
mapID = "plains"
}
if err := g.mapManager.SetCurrentMap(mapID); err != nil {
g.mapManager.SetCurrentMap("plains")
}