App Competition (Win £35)

It’s competition time! We’re looking for you all to create a small interactive application using our 2D Lua API. It can literally be anything, we’re just looking for creativity.

Rules and Criteria:

  • Must be your own individual code
  • Must have some form of interactivity (through touch, mouse or keyboard input)
  • Must not be overly complex and should have clean code
  • Must be a single player app
  • Must be submitted before Friday, 29th of May 22:00 British Summer Time. Winners will be selected and contacted within a week of deadline. Winners have 24 hours to respond to claim their prize otherwise a new winner will take their place.

Prize:

  • Voucher valued at £35 for the winner
  • Voucher valued at £10 for a runner up

Further details:

  • Utilise our autogenerated docs http://teverse.com/docs
  • Use our community here and on our Discord server!
  • Bonus points to those who manage to find and report bugs with our engine

How to submit:
Create your Lua file using your favourite text editor and run it in Teverse using the “Run Script” button, click share on the bottom of the app and include “COMPETITION” in the name of your app.

Quick demonstration of our GUI api:

Source of this demo (Requires 0.20.13, pending release at time of post)

-- Bad example

-- Create a full width, 40 pixel high banner on top of the screen
local topbar = teverse.construct("guiTextBox", {
    parent              = teverse.interface,
    size                = guiCoord(1.0, 0, 0.0, 60),
    position            = guiCoord(0.0, 0, 0.0, 0),
    backgroundColour    = colour(1, 0, 0),
    text                = "Testing 1234?",
    textSize            = 36,
    textColour          = colour(1, 1, 1),
    textAlign           = "middle",
    textShadowSize      = 4,
    textShadowColour    = colour(0, 1, 1),
    textFont            = "tevurl:fonts/random5.otf", -- You can request additional fonts via discord
})

-- Create a little square inside the banner (just to spin it)
local square = teverse.construct("guiTextBox", {
    parent              = topbar,
    size                = guiCoord(0.0, 30, 0.0, 30),
    position            = guiCoord(0.9, -30, 0.5, -15),
    backgroundColour    = colour(0, 0, 0),
    strokeRadius        = 10,
    strokeWidth         = 4,
    strokeColour        = colour(1, 1, 1),
    strokeAlpha         = 1.0
})

-- The code wrapped inside spawn is ran on a new thread
-- Meaning sleeping inside this function will not delay the rest of the script
spawn(function()
    while sleep(1) do
        -- Animate the topbar colour to change over 2 seconds
        teverse.tween:begin(topbar, 1, {
            backgroundColour    = colour(1, 0, 1),
            textColour          = colour(0, 0, 0)
        })
        
        -- Animate the square to change also
        teverse.tween:begin(square, 1, {
            rotation        = math.rad(180),
            strokeRadius    = 0
        })
        
        sleep(1)
        
        teverse.tween:begin(topbar, 1, {
            backgroundColour    = colour(1, 0, 0),
            textColour          = colour(1, 1, 1)
        })
        
        -- Animate the square to change also
        teverse.tween:begin(square, 1, {
            rotation        = math.rad(0),
            strokeRadius    = 15
        })
    end
end)

-- Create a container on the left half of the screen (width is 50% of the screen)
--
local sv = teverse.construct("guiScrollView", {
    parent              = teverse.interface,
    size                = guiCoord(0.5, -20, 1.0, -100),
    position            = guiCoord(0.0, 10, 0.0, 70),
    backgroundColour    = colour(1, 1, 1),
    strokeRadius        = 4,
    strokeAlpha         = 0.5,
    strokeWidth         = 5,
    strokeColour        = colour(0, 1, 1),
    scrollbarColour     = colour(0, 1, 0),
})

teverse.construct("guiTextBox", {
    parent              = sv,
    size                = guiCoord(1.0, -20, 0.0, 26),
    position            = guiCoord(0.0, 10, 0.0, 10),
    backgroundAlpha     = 0.0,
    text                = "Heading 1",
    textSize            = 26,
    textFont            = "tevurl:fonts/openSansBold.ttf"
})

teverse.construct("guiTextBox", {
    parent              = sv,
    size                = guiCoord(1.0, -20, 0.0, 26),
    position            = guiCoord(0.0, 10, 0.0, 36),
    backgroundAlpha     = 0.0,
    text                = "The code in this app is BAD, but it IS an example.",
    textSize            = 18
})

teverse.construct("guiTextBox", {
    parent              = sv,
    size                = guiCoord(1.0, -20, 0.0, 26),
    position            = guiCoord(0.0, 10, 0.0, 62),
    backgroundAlpha     = 0.0,
    text                = "Heading 2",
    textSize            = 26,
    textFont            = "tevurl:fonts/openSansBold.ttf"
})

teverse.construct("guiTextBox", {
    parent              = sv,
    size                = guiCoord(1.0, -20, 1.0, -88),
    position            = guiCoord(0.0, 10, 0.0, 88),
    backgroundAlpha     = 0.0,
    text                = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus euismod lacus eget lectus suscipit ullamcorper. Praesent tellus dolor, lobortis sed sem et, feugiat consectetur nunc. Mauris eget augue sed augue tincidunt mattis. Proin scelerisque quam eu ipsum dictum cursus. Etiam pulvinar sapien ante, eget tristique purus volutpat eu. Nullam a quam malesuada, faucibus tortor eu, mollis leo. Pellentesque id metus arcu. Phasellus quis sapien purus. In iaculis arcu erat, eget mattis velit elementum non. Suspendisse tempus neque id arcu rhoncus maximus. Aenean a erat ut dolor efficitur hendrerit. Nulla quam diam, posuere eu ante ac, tempor facilisis purus. Duis molestie metus sit amet sem dapibus, quis commodo tortor congue.",
    textSize            = 18,
    textWrap            = true
})

local squares = {}

-- Random squares, why not?
for x = 1, 5 do
    for y = 1, 5 do
        local newSquare = teverse.construct("guiFrame", {
            parent              = sv,
            size                = guiCoord(0, math.random(10, 50), 0, math.random(10, 50)),
            position            = guiCoord(0.2 + (math.random()/2), 0, 1 + (math.random()/2), 0),
            backgroundColour    = colour.random(),
            strokeRadius        = math.random(0, 10),
            strokeAlpha         = math.random(),
            strokeWidth         = math.random(0, 4),
            strokeColour        = colour.random(),
            rotation            = math.random()
        })
        
        table.insert(squares, newSquare)
    end
end

spawn(function()
    -- pointless animations
    sleep(2)
    for _,v in pairs(squares) do
        teverse.tween:begin(v, math.random() * 6, {
            size                = guiCoord(0, math.random(10, 50), 0, math.random(10, 50)),
            position            = guiCoord(0.1 + (math.random()/1.5), 0, 0.7 + (math.random()/1.5), 0),
            backgroundColour    = colour.random(),
            strokeRadius        = math.random(0, 10),
            strokeAlpha         = math.random(),
            strokeWidth         = math.random(0, 4),
            strokeColour        = colour.random(),
            rotation            = math.random()
        })
    end
end)

local rightContainer = teverse.construct("guiFrame", {
    parent              = teverse.interface,
    size                = guiCoord(0.5, -20, 1.0, -100),
    position            = guiCoord(0.5, 10, 0.0, 70),
    backgroundColour    = colour(0.1, 0.1, 0.1)
})

local colours = {
    colour(1, 0, 0),
    colour(1, 1, 0),
    colour(0, 1, 0),
    colour(0, 1, 1),
    colour(0, 0, 1),
    colour(1, 0, 1)
}

local gradients = {}

local size = 1/#colours
local lastColour = colour(0,0,0)
for i = 1, #colours do
    local c = colours[i]
    local gradient = teverse.construct("guiGradientFrame", {
        parent = rightContainer,
        size = guiCoord(size, 2, 0, 60),
        position = guiCoord(size * (i - 1), -1, 0, 0),
        backgroundColour = lastColour,
        backgroundColourB = c,
        start = guiCoord(0.1, 0, 0, 0),
        finish = guiCoord(0.9, 0, 0, 0)
    })
    lastColour = c
    table.insert(gradients, gradient)
end

-- moving gradient effect
spawn(function()
    while sleep() do
        for i = 1, #colours do
            local lastColour = colours[i];
            for _,gradient in pairs(gradients) do
                teverse.tween:begin(gradient, 0.5, {
                    backgroundColour = lastColour,
                    backgroundColourB = gradient.backgroundColour,
                }, "linear")
                lastColour = gradient.backgroundColour
            end
            sleep(1.5)
        end
    end
end)

-- lines demo
for i = 1, #colours do
    local a = teverse.construct("guiLineBezier", {
        pointA      = guiCoord(0, 10, 0, 100 + (i * 15)),
        controlA    = guiCoord(1.0, 0, 0, -50),
        pointB      = guiCoord(1, -20, 0, 100 + (i * 15)),
        controlB    = guiCoord(-0.5, 0, 0, 100),
        parent      = rightContainer,
        lineWidth   = 5,
        lineColour  = colours[i],
        lineCap     = "round",
        zIndex      = #colours - i
    })
end

local squaresContainer = teverse.construct("guiFrame", {
    parent              = rightContainer,
    size                = guiCoord(1.0, -20, 1.0, -210),
    position            = guiCoord(0.0, 10, 0.0, 200),
    backgroundColour    = colour(0.2, 0.2, 0.2)
})

local function onHover()
    if self.backgroundAlpha == 0 then
        self.backgroundAlpha = 1.0
        self.backgroundColour = colour.random()
        teverse.tween:begin(self, 0.5, {
            backgroundAlpha = 0
        }, "inBounce")
    end
end

-- squares that change on hover
for x = 0, 1, 0.05 do
    for y = 0, 1, 0.05 do
        local col = 0.6 + (math.random() / 3)
        local s = teverse.construct("guiFrame", {
            parent              = squaresContainer,
            size                = guiCoord(0.05, 0, 0.05, 0),
            position            = guiCoord(x, 0, y, 0),
            backgroundColour    = colour(col, col, col),
            backgroundAlpha     = 0.0
        })
        s:on("mouseEnter", onHover)
    end
end
6 Likes