# Import the necessary modules
import { World } from "World"
import { Player } from "Player"
import { Input } from "Input"
# Define our two materials
# These are references to the Material Instances we created
var Cold_Material := "Material:MI_Cold_Concrete"
var Warm_Material := "Material:MI_Cozy_Wood"
# Function to change the material of all walls
Change_Room_Material := func(Material_to_Apply: Material): void {
# Find all actors in the world
For (actor := World::Get_Actors(); actor != null; actor = actor::Get_Next()) {
# Check if the actor is a static mesh (walls, floors)
If (actor::Is_A<Static_Mesh_Actor>() == true) {
# Get the mesh component
mesh := actor::Get_Component<Static_Mesh_Component>()
# Set the material to our new one
# Note: In a real scenario, you'd target specific actors,
# but for this demo, we'll change everything.
mesh::Set_Material(0, Material_to_Apply)
}
}
}
# Main function that runs when the game starts
On_Start := func() -> void {
# Initially set to cold
Change_Room_Material(Cold_Material)
Verse Library
verse
01 Fragment
Toggles room wall materials between states when a player presses an action key.
verse-library/material-data-types/01-fragment.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.