Tvick22 / platformer3x

Student repository for Trimester 3, Spring 2024. (Leaderboard Team)
https://tvick22.github.io/platformer3x/
Apache License 2.0
0 stars 0 forks source link

Completed Dimming #43

Closed AZaletski24 closed 4 months ago

AZaletski24 commented 4 months ago

Leaderboard

create () {
            this.dim = true // sets the dim to be true when the leaderboard is opened
            console.log("CREATE DIM")
            const dimDiv = document.createElement("div");
            dimDiv.id = "dim";
            dimDiv.style.backgroundColor = "black";
            dimDiv.style.width = "100%";
            dimDiv.style.height = "100%";
            dimDiv.style.position = "absolute";
            dimDiv.style.opacity = "0.8";
            document.body.append(dimDiv);
            dimDiv.style.zIndex = "9998"
            dimDiv.addEventListener("click", Leaderboard.backgroundDim.remove)
        },
remove () {
            this.dim = false
            console.log("REMOVE DIM");
            const dimDiv = document.getElementById("dim");
            dimDiv.remove();
            Leaderboard.isOpen = false
            leaderboardDropDown.style.width = this.isOpen?"70%":"0px";
            leaderboardDropDown.style.top = this.isOpen?"15%":"0px";
            leaderboardDropDown.style.left = this.isOpen?"15%":"0px";
        },

SettingsControl

onst backgroundDim = {
    create () {
        this.dim = true // sets the dim to be true when settingControl is opened
        console.log("CREATE DIM")
        const dimDiv = document.createElement("div");
        dimDiv.id = "dim";
        dimDiv.style.backgroundColor = "black";
        dimDiv.style.width = "100%";
        dimDiv.style.height = "100%";
        dimDiv.style.position = "absolute";
        dimDiv.style.opacity = "0.8";
        document.body.append(dimDiv);
        dimDiv.style.zIndex = "9998"
        dimDiv.addEventListener("click", this.remove)
    },
    remove () {
        this.dim = false
        console.log("REMOVE DIM");
        const dimDiv = document.getElementById("dim");
        dimDiv.remove();
        isOpen = false
        const sidebar = document.getElementById("sidebar")
        sidebar.style.width = isOpen?"70%":"0px";
        sidebar.style.top = isOpen?"15%":"0px";
        sidebar.style.left = isOpen?"15%":"0px";
    }
}

Screenshot 2024-05-16 1 56 18 PM

Example picture of what the working dim looks like