Skip to content

nyaengine/Documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Nya Engine logo

Nya Engine Documentation

Nya Engine is a community-driven 2D game engine built with LÖVE2D, designed to be lightweight, easy to use, and kawaii 🌸. Nya Engine includes an integrated IDE, visual scripting, Lua coding, object and scene management, UI customization, and more — all to empower game developers to create amazing interactive 2D games quickly and easily.

Table of Contents

Examples

Nya Engine uses the default LÖVE syntax and some additional custom libraries.

  • ButtonLibrary

It's a library for easy creation of buttons.

To create a button use ButtonLibrary:new(x, y, width, height, text, function, image(optional))

for example:

    function love.load()
      Button = ButtonLibrary:new(0, 100, 500, 100, "Test", function()
        print("test")
    end)

You can also change the background transparency by using this code:

    Button:IsVisibleBG(false) -- true or false

or

    Button:SetTransparency(1) -- transparency value

If you want to change the button position while the game is running you can do:

    function love.draw()
        Button:setPosition(x, y)
    end

This is the whole example for creating buttons:

    local ButtonPressed = false

    function love.load()
      Button = ButtonLibrary:new(0, 100, 500, 100, "Test", function()
        ButtonPressed = not ButtonPressed
    end)

    function love.update(dt)
        local mouseX, mouseY = love.mouse.getPosition()

        Button:update(mouseX, mouseY)
    end

    function love.draw()
        Button:draw()

        if ButtonPressed == true then
            Button:setPosition(100, 100)
        else
            Button:setPosition(0, 100)
        end
    end

    function love.mousepressed(x, y, button, istouch, presses)
        Button:mousepressed(x, y, button)
    end

This code makes it so when the button is pressed then it changes the position.

  • ObjectLibrary

This library is responsible for all the objects in the game. To create an Object use:

    local newObject = GameObject:new({
        x = 150,
        y = 100,
        width = 50,
        height = 50,
        icon = nil,
        name = "Object",
        isCollidable = false,
        texture = nil,
        character = false,
        -- you can add more stuff here
    })
  • Parallex Backgrounds

This library is responsible for parallex background rendering.

function love.load()
  local background = ParallexBackground:new()
  background:addLayer("assets/background_layer1.png", 20) -- Add a slow-moving layer
  background:addLayer("assets/background_layer2.png", 40) -- Add a faster-moving layer
end

function love.update(dt)
  background:update(dt)
end

function love.draw()
  background:draw()
end
  • love

LÖVE syntax is available here

Syntax

About

Nya Engine Documentation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published