Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GBA_engine

32bits, gameboy advance like engine · By Magnus Oblerion

Lua api Locked

A topic by Magnus Oblerion created Dec 30, 2023 Views: 56
This topic is locked
Viewing posts 1 to 1
Developer (11 edits)

a1.5

Main

loop function

function EGBA()
-- your code run 60/seconds
end

log

trace("hi")
-- print hi in console (only string)
local v=2 print("value :",v)
-- lua print function can be used to view variable value in console

palette swap

pal(2)
-- id 0 -> 4, change curant palette 
-- for all function after with id color    

Graphics

clear screen

cls(0)
-- clear screen with id color 0 

print text

text("hello world",23,23,0,16)
-- x 23, y 23, id color 0,font size 16

draw rectangle

rect(23,23,50,50,2)
-- draw fill rectangle in x 23, y 23, width 50, height 50, id color 2
rectb(23,23,50,50,2)
-- draw line rectangle in x 23, y 23, width 50, height 50, id color 2 

draw pixel

pix(10,10,2)
-- draw pixel in x 10,y 10, id color 2

draw sprite

spr(1,23,23,2)
-- draw sprite id 1,x 23,y 23,scale 2

Input

keyboard

if btn(0) then
-- if key down is down
elseif btn(1) then
-- if key up is down
end
if btnp(2) then
-- if key left is pressed 
elseif btnp(3) then
-- if key right is pressed
end
-- id 0 : down, 1 : up, 2 : left, 3 : right, 4 : x, 5 : c
-- btn -> btn is down
-- btnp -> btn is pressed

mouse

local x,y,btnl,btnm,btnr = mouse()
-- x = x mouse
-- y = y mouse
-- btnl = true/false mouse left button
-- btnm = true/false mouse mid button
-- btnr = true/false mouse right button 

a0.1

Main

loop function

function EGBA()
-- your code run 60/seconds
end

log

trace("hi")
-- print hi in console

Graphics

clear screen

cls(0)
-- clear screen with color 0 of first palette

print text

print("hello world",23,23,0,16)
-- x 23, y 23, id color 0,font size 16

draw rectangle

rect(23,23,50,50,2)
-- draw fill rectangle in x 23, y 23, width 50, height 50, id color 2
rectb(23,23,50,50,2)
-- draw line rectangle in x 23, y 23, width 50, height 50, id color 2 

draw sprite

spr(1,23,23,2)
-- draw sprite id 1,x 23,y 23,scale 2

Input

keyboard

if btn(0) then
-- if key down is down
elseif btn(1) then
-- if key up is down
end
if btnp(2) then
-- if key left is pressed 
elseif btnp(3) then
-- if key right is pressed
end
-- id 0 : down, 1 : up, 2 : left, 3 : right
-- btn -> btn is down
-- btnp -> btn is pressed

mouse

local x,y,btnl,btnm,btnr = mouse()
-- x = x mouse
-- y = y mouse
-- btnl = true/false mouse left button
-- btnm = true/false mouse mid button
-- btnr = true/false mouse right button