Skip to content

Add background switching functionality with UI selector#31

Merged
Null000 merged 1 commit intomainfrom
claude/add-actor-backgrounds-LxYOp
Feb 22, 2026
Merged

Add background switching functionality with UI selector#31
Null000 merged 1 commit intomainfrom
claude/add-actor-backgrounds-LxYOp

Conversation

@Null000
Copy link
Copy Markdown
Owner

@Null000 Null000 commented Feb 22, 2026

Summary

This PR adds the ability to dynamically switch between different background types during gameplay through a new UI control panel.

Key Changes

  • New switchBackground() function: Manages background transitions by removing the current background and adding a new one at the correct z-index (right after the mask layer)
  • Background state tracking: Added currentBackground variable to keep track of the active background sprite
  • UI control panel: Added a dropdown selector in the HTML with 8 background options (Village, Forest, Dark Forest, Dungeon, Swamp, Mountains, Graveyard, Volcano)
  • Event listener: Wired up the background selector to trigger background switches and log the change
  • Refactored initialization: Updated the init() function to use the new switchBackground() function instead of directly creating and adding the background

Implementation Details

  • The switchBackground() function properly cleans up the previous background before adding a new one
  • Backgrounds are inserted at index 1 in the world container to maintain proper layering (after the mask)
  • The background selector uses the BackgroundType enum values for consistency
  • User actions are logged to the console for debugging purposes

https://claude.ai/code/session_01MS7EGJedRFXeSceQaiznNW

Add a dropdown to actors.html that allows switching between all 8
background types (Village, Forest, Dark Forest, Dungeon, Swamp,
Mountains, Graveyard, Volcano) instead of hardcoding Village.

https://claude.ai/code/session_01MS7EGJedRFXeSceQaiznNW
@Null000 Null000 merged commit 05caf89 into main Feb 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants