A talk by Ciro Durán (@chiguire)
ciro.duran@gmail.com
FLISOL Madrid 2018
This talk has speaker notes! Press 's' to read.
Estas láminas también están en español: http://ciroduran.com/talks/2018/liko12/es
Component | Info |
---|---|
CPU | LuaJIT (Lua 5.1) |
GPU | 192x128 4-Bit screen |
Map | 144x128 cells (255 tiles) |
HDD | 2x 25MB drives |
Input | Keyboard, mouse, touch and control |
(First attempt)
-- Hello World 1
clear(0)
print("HOLA FLISOL!",50,50)
line(12, 12, 50, 60)
Code in https://pastebin.com/5pmdw4cL
Run it in LIKO-12: pastebin get 5pmdw4cL hola1.lk12
(Second attempt)
-- Hello World 2
function _init()
clear(0)
end
function _draw()
print("HOLA FLISOL!",50,50)
line(12, 12, 50, 60)
end
function _update()
end
Code in https://pastebin.com/C801GkkQ
Run it in LIKO-12: pastebin get C801GkkQ hola2.lk12
(Third attempt)
-- Hello World 3
n = 1
COLORS = {2,4,3,5,6,8,7,9}
max = 30
angle = 60
speed = 15
timer = speed
x = 0 -- initialized in _init()
y = 0 -- initialized in _init()
radius = 0 -- initialized in _init()
function pointCircle(x,y,r,angle_rad)
return
x+math.sin(angle_rad)*r,
y+math.cos(angle_rad)*r
end
function screenDims()
return {
x = screenWidth()/2,
y = screenHeight()/2,
radius = (screenHeight() <
screenWidth()) and
(screenHeight()/2*0.9) or
(screenWidth()/2*0.9)
}
end
function _init()
clear(0)
dims = screenDims()
x = dims.x
y = dims.y
radius = dims.radius
end
function _draw()
clear(0)
for i=1,n do
coloralt=(i%#COLORS)+1
a = math.rad(i*360/max + angle)
b = math.rad(i*360/max - angle)
p1_x, p1_y = pointCircle(x,y,radio,a)
p2_x, p2_y = pointCircle(x,y,radio,b)
line(p1_x,p1_y,p2_x,p2_y,coloralt)
end
print(
"HOLA FLISOL!",
screenWidth()/2 - 28,
screenHeight()/2
)
end
function _update()
if timer > 0 then
timer = timer - 1
if timer == 0 then
n = n + 1
timer = speed
end
end
end
Code in https://pastebin.com/x7wuaWTH
Run it in LIKO-12: pastebin get x7wuaWTH hola3.lk12
(Vou baixar a Lua)
clear(colourn) |
Cleans screen |
print(text, x, y, [colour]) |
Prints a text in position |
line(x1,y1,x2,y2,[color]) |
Draws a line |
Sprite(tileID,x,y,[rotation]) |
Draws a sprite in position |
map(x,y,tx1,ty1,tx2,ty2) |
Draws a map |
mset(x,y,tile)/mget(x,y) |
Manipulate the map |
clip(x1,y1,x2,y2) |
Limit drawing to this area |
cam(...) |
Camera operations |
local Fruit = class("Fruit") -- a class called "Fruit"
Fruit.static.myvalue = 2 -- static values and function
function Fruit:initialize(color) -- ...
local Mango = class("Mango", Fruit) -- subclassing
Audio.generate(1,250,1) -- to play a note
Audio.generate() -- to stop
In the command line:
install_demos
install_games
Erni's Iceberg (WIP), by Thirite
This game and code available in http://github.com/chiguire/sapper
This slides, and notes, in http://ciroduran.com/talks/2018/liko12/es
I'm on Twitter: @chiguire
Email: ciro.duran@gmail.com