Skip to content
EngineMachiner edited this page Dec 11, 2025 · 5 revisions
-- Taken from beat4sprite OutFox gameplay animation.

local SoundWaves = beat4sprite.Modules.SoundWaves

local Quad = SoundWaves.Quad() .. { OnCommand=function(self) self:Center():blend('add') end }

-- SoundWaves.Quad() is a function from the Soundwaves module and returns a coloured rectangle based on Soundwaves preferences.

return beat4sprite.Builder.Load {

    -- Sets the texture path and the front layer with a soundwaves quad at the front.
    Texture = "OutFox/SoundWaves/A 6x10.png",          Layers = { Front = Quad },

    -- Set the sprite animation starting from frame 1 to frame 60 and set the zoom.
    States = { First = 1, Last = 60 },          Zoom = 2.85

}

-- Taken from OF004E.

local SoundWaves = beat4sprite.Modules.SoundWaves           local planeAxes = Astro.Vector.planeAxes -- { 'x', 'y' }

return beat4sprite.BaseFrame { -- The BaseFrame handles visibility when the animation is not active.

    SoundWaves.Quad() .. { OnCommand=function(self) self:Center() end },

    beat4sprite.Builder.Load {

        Zoom = 3,           Blend = 'add',          Colors = { Color.White, Color.Red }, -- Sets the colors for the effect to use next.

	Texture = "OutFox/SoundWaves/A 6x10.png",         States = { Last = 60,    Position = true }, -- Position sets an animation offset based on the tile position.
        
        Sprite = { -- Extend sprite commands and behaviour.

            OnCommand=function(self)

                self.Effect.Period = 8 -- Set the sprite effect period.

                local matrix = self.TileParent.Matrix -- Get the tile matrix size.
                local offset = self.TilePos -- Get the sprite position in the tile matrix.

                for i,v in ipairs(planeAxes) do offset[v] = offset[v] * 0.5 / matrix[v] end -- Make the effect offset based on these variables.

                self:setEffectOffset(offset):setEffect("diffuseshift") -- Apply the diffuseffect using setEffect()

            end

        }

    }

}

Clone this wiki locally