BF:BFD[
7.2] → [
8.1671:1713]
B:BD[
9.196] → [
2.558:747]
B:BD[
8.110] → [
8.110:131]
B:BD[
8.131] → [
9.197:222]
B:BD[
9.222] → [
10.59:181]
∅:D[
10.181] → [
9.534:544]
B:BD[
9.534] → [
9.534:544]
∅:D[
10.330] → [
9.544:548]
B:BD[
9.544] → [
9.544:548]
B:BD[
8.415] → [
8.415:422]
B:BD[
8.422] → [
9.549:575]
B:BD[
9.575] → [
10.331:499]
∅:D[
10.499] → [
9.714:719]
B:BD[
9.714] → [
9.714:719]
B:BD[
8.556] → [
8.556:563]
B:BD[
8.563] → [
9.720:832]
∅:D[
10.572] → [
9.832:875]
B:BD[
9.832] → [
9.832:875]
B:BD[
9.1019] → [
9.1019:1024]
∅:D[
9.1024] → [
8.803:810]
B:BD[
8.803] → [
8.803:810]
B:BD[
8.810] → [
9.1025:1053]
B:BD[
9.1053] → [
10.573:697]
∅:D[
10.697] → [
9.1150:1468]
B:BD[
9.1150] → [
9.1150:1468]
B:BD[
11.67] → [
9.1469:1499]
B:BD[
9.1499] → [
10.698:1009]
∅:D[
10.1009] → [
9.1879:2188]
B:BD[
9.1879] → [
9.1879:2188]
∅:D[
9.2188] → [
12.386:393]
B:BD[
12.386] → [
12.386:393]
B:BD[
12.393] → [
9.2189:2221]
B:BD[
9.2221] → [
10.1010:1492]
∅:D[
10.1492] → [
9.2728:3258]
B:BD[
9.2728] → [
9.2728:3258]
∅:D[
11.752] → [
8.1206:1213]
∅:D[
12.1387] → [
8.1206:1213]
∅:D[
9.3258] → [
8.1206:1213]
B:BD[
8.1206] → [
8.1206:1213]
B:BD[
8.1213] → [
9.3259:3363]
B:BD[
9.3363] → [
13.59:135]
∅:D[
13.135] → [
10.1581:1637]
B:BD[
10.1581] → [
10.1581:1637]
B:BD[
10.1637] → [
13.136:197]
∅:D[
5.134] → [
13.197:237]
B:BD[
13.197] → [
13.197:237]
B:BD[
13.237] → [
4.92:251]
∅:D[
13.237] → [
10.1638:1705]
∅:D[
4.251] → [
10.1638:1705]
B:BD[
9.3551] → [
10.1638:1705]
B:BD[
10.1705] → [
13.238:275]
B:BD[
13.275] → [
3.88:113]
∅:D[
14.70] → [
13.300:757]
B:BD[
13.300] → [
13.300:757]
B:BD[
13.757] → [
3.114:130]
∅:D[
3.130] → [
13.773:820]
B:BD[
13.773] → [
13.773:820]
∅:D[
15.75] → [
13.923:1285]
B:BD[
13.923] → [
13.923:1285]
B:BD[
13.1285] → [
15.76:168]
∅:D[
15.168] → [
13.1408:1469]
B:BD[
13.1408] → [
13.1408:1469]
B:BD[
13.1469] → [
15.169:210]
∅:D[
15.210] → [
13.1524:1615]
B:BD[
13.1524] → [
13.1524:1615]
B:BD[
13.1615] → [
15.211:242]
∅:D[
15.242] → [
13.1660:1795]
B:BD[
13.1660] → [
13.1660:1795]
B:BD[
13.1795] → [
15.243:275]
∅:D[
15.275] → [
13.1841:1942]
B:BD[
13.1841] → [
13.1841:1942]
B:BD[
13.1942] → [
14.71:189]
∅:D[
14.189] → [
13.2021:2267]
B:BD[
13.2021] → [
13.2021:2267]
B:BD[
13.2267] → [
15.276:317]
∅:D[
15.317] → [
13.2306:3057]
B:BD[
13.2306] → [
13.2306:3057]
∅:D[
10.1705] → [
9.3784:3789]
∅:D[
13.3057] → [
9.3784:3789]
B:BD[
9.3784] → [
9.3784:3789]
∅:D[
11.845] → [
8.1601:1608]
∅:D[
9.3789] → [
8.1601:1608]
B:BD[
8.1601] → [
8.1601:1608]
B:BD[
8.1608] → [
9.3790:3820]
B:BD[
9.3820] → [
16.88:142]
B:BD[
16.142] → [
6.93:186]
∅:D[
16.142] → [
9.3876:3883]
∅:D[
6.186] → [
9.3876:3883]
∅:D[
15.372] → [
9.3876:3883]
B:BD[
9.3876] → [
9.3876:3883]
∅:D[
16.282] → [
9.3883:3892]
B:BD[
9.3883] → [
9.3883:3892]
B:BD[
9.3892] → [
6.187:189]
B:BD[
9.3883] → [
16.143:282]
B:BD[
13.197] → [
5.92:134]
B:BD[
9.832] → [
10.500:572]
B:BD[
9.544] → [
10.182:330]
-- some examples that each get loaded into a pane
-- each example has a name, so we can avoid bringing back up an example someone deleted.
-- Be careful not to rename example panes; that will cause them to pop up again and annoy people who've already deleted them.
-- If you delete a name, be careful not to reuse it in future.
Example_panes = {
{
name='expr',
lines={
'-- Some examples; feel free to delete.',
'-- First example: you can perform',
'-- simple calculations.',
'',
'2+3',
}
},
{
name='print',
lines={
'-- print() calls show up in the area',
"-- below. Hit 'run' and then try scrolling",
'-- through the results.',
'for i=1,20 do',
' print(i)',
'end',
},
},
{
name='draw',
lines={
'-- You can draw on the screen.',
"-- After you hit 'run', try hitting 'hide'.",
'love.graphics.line(100,100, 200,300)',
},
},
{
name='pattern',
lines={
'-- A larger drawing: A checkerboard',
'-- Notice Safe_width and Safe_height',
'-- for the bounds of the screen.',
'n = 100',
'for x=0,Safe_width,n do',
' for y=0,Safe_height,n do',
' if (x+y)/n%2 == 0 then',
' love.graphics.setColor(0.9, 0.7, 0.7)',
' else',
' love.graphics.setColor(0.7, 0.7, 0.9)',
' end',
" love.graphics.rectangle('fill', x,y, n,n)",
' end',
'end',
},
},
{
name='animation',
lines={
'-- For animations, you can define various',
'-- functions that will get called for you.',
'-- LÖVE looks for functions called',
'-- love.draw, love.update, etc.',
"-- You can't define those directly (they",
'-- contain Carousel code), but you can',
'-- define car.draw, car.update,etc.',
'Radius, dRadius = 100, 10',
'function car.draw()',
" love.graphics.circle('fill', 100,100, Radius)",
'end',
'',
'function car.update(dt)',
' Radius = Radius+dRadius',
' if Radius > 500 then dRadius = -dRadius end',
' if Radius < 30 then dRadius = -dRadius end',
'end',
},
},
{
name='interactive',
lines={
'-- For interactivity, LÖVE provides',
'-- functions like love.keypressed,',
'-- love.mousepressed, etc.',
'-- As before, define car.keypressed,',
'-- car.mousepressed, etc.',
'-- These interactive events only activate',
'-- when the editor is hidden using the',
"-- 'hide' button above.",
'--',
'-- Try running this example and then',
'-- pressing and holding the mouse and',
'-- typing keys.',
'-- Then try again after hiding the editor.',
'X, Y, dX = 100, 0, 10',
"Log = ''",
'',
'function car.draw()',
' love.graphics.line(X,Y, X,Y+300)',
' love.graphics.print(Log, 50,50)',
'end',
'',
'function car.update(dt)',
' if X > 500 then dX = -dX end',
' if X < 100 then dX = -dX end',
' X = X+dX',
'end',
'',
'function car.mousepressed(x,y, button)',
' Y = y',
'end',
'',
'function car.mousereleased(x,y, button)',
' Y = 0',
'end',
'',
'function car.keypressed(key)',
' Log = Log..key',
'end',
},
},
{
name='abbreviations',
lines={
'-- Some abbreviations to reduce typing.',
'g = love.graphics',
'pt, line = g.points, g.line',
'rect, poly = g.rectangle, g.polygon',
'circle, arc, ellipse = g.circle, g.arc, g.ellipse',
'color = g.setColor',
'min, max = math.min, math.max',
'abs, rand = math.abs, math.random',
'pi, cos, sin = math.pi, math.cos, math.sin',
'touches = love.touch.getTouches',
'touch = love.touch.getPosition',
'audio = love.audio.newSource',
"-- Hit 'run', Now they're available to other",
'-- panes.',
},
},
{
name='circ',
lines={
'-- A snazzy circle',
'-- Try hiding the editor and tapping',
'-- around on screen.',
'cx, cy, N = 30, 100, 100',
'function dist2(x1,y1, x2,y2)',
' return (x2-x1)^2 + (y2-y1)^2',
'end',
'',
'function car.draw()',
' for x=cx-N,cx+N do',
' for y=cy-N,cy+N do',
' if dist2(cx,cy, x,y) < N*N then',
' color(abs(x-cx)/N, abs(y-cy)/N, 0.5)',
' pt(x,y)',
'end end end end',
'',
'function car.mousepressed(x,y, b)',
' cx,cy = x,y',
'end',
},
},
{
name='pacman',
lines={
'-- Pacman',
'function init_balls()',
' balls = {}',
' for x=50,Safe_width-1,50 do',
' for y=30,Safe_height-1,50 do',
' table.insert(balls, {x=x, y=y, show = true})',
'end end end',
'init_balls()',
'',
'function eat_ball()',
' for _,b in ipairs(balls) do',
' if b.x == x and b.y == y then',
' b.show = false',
'end end end',
'',
'x, y = 30, 30',
'dx = 5',
'dang = 0 -- change in mouth angle',
'',
'function car.draw()',
' color(0.8, 0.8, 0)',
" arc('fill', x,y, 20, dang + 0.5, dang + 2*math.pi - 0.5)",
' for _,b in ipairs(balls) do',
' if b.show then',
" circle('fill', b.x, b.y, 10)",
'end end end',
'',
'function car.update(dt)',
' x = x+dx',
' eat_ball()',
' if x > Safe_width then',
' y, dx = y+50, -5',
' dang = math.pi',
' elseif x < 0 then',
' y, dx = y+50, 5',
' dang = 0',
' end',
' if y > Safe_height then',
' y = 30',
' init_balls()',
' end',
'end',
},
},
{
name='trails',
lines={
'-- This one is for a multitouch screen.',
'-- Try hiding the editor and swiping',
'-- your finger around.',
'W,H = g.getDimensions()',
'T = 0.1 -- seconds',
'U = 0',
'',
'trails = {}',
'',
'function car.draw()',
' for _,trail in pairs(trails) do',
' color(trail.r, trail.g,trail.b)',
' for _,c in ipairs(trail) do',
" circle('fill', c.x,c.y, c.r)",
'end end end',
'',
'function car.update(dt)',
' U = U + dt',
' if U < T then return end',
' U = U - T',
' local touches = love.touch.getTouches()',
' for _,id in ipairs(touches) do',
' local x,y = love.touch.getPosition(id)',
' if trails[id] then',
' table.insert(trails[id], 1, {x=x, y=y, r=100})',
'end end',
' for id,trail in pairs(trails) do',
' for i=#trail,1,-1 do',
' local c = trail[i]',
' c.r = c.r - 10',
' if c.r <= 0 then table.remove(trail, i) end',
' end',
' if #trail == 0 then trails[id] = nil end',
' end',
'end',
'',
'function car.touchpressed(id, x,y, ...)',
' trails[id] = {r=rand(), g=rand(), b=rand()}',
'end',
},
},
{
name='beginning',
lines={
'-- Over to you. We hope you enjoy Lua Carousel!',
'-- Looking for more inspiration?',
'-- Try https://akkartik.itch.io/carousel/devlog',
'',
},
},
}
'-- P.S. As you create your programs,',
"-- don't forget to hit the 'save' button",
'-- above to preserve them across restarts.',
'floor, ceil = math.floor, math.ceil',
'-- The editor will disappear. Hit show',
"-- to bring it back.",
'',
"-- Try hitting the 'run' button above.",
"-- When you're done, tap on the",
'-- right margin to go to the next',
'-- example.',