jogos em lua com löve
DESCRIPTION
Descreve o framework de criacao de jogos 2D LOVETRANSCRIPT
![Page 1: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/1.jpg)
Jogos em Lua com LÖVEHamilton Lima Jr.MediaLab – UFFwww.athanazio.com
Lua workshop 2009
![Page 2: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/2.jpg)
2
Agenda
•O que é LÖVE•Componentes•Exemplos
▫Hello world ▫Controle de teclado▫Fisica
•Jogos completos
![Page 3: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/3.jpg)
3
O que é LÖVE
•Game engine 2D•Usa LUA como linguagem de
programação•Oferece suporte a multiplos tipos de
imagem e som•Oferece suporte a fontes True-type•É considerada inquestionavelmente
impressionante
![Page 4: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/4.jpg)
4
“LÖVE is an unquestionably awesome 2D game engine, which allows rapid game
development and prototyping in Lua“
http://love2d.org
![Page 5: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/5.jpg)
5
O que é LÖVE
•OpenGL - http://opengl.org•SDL - http://libsdl.org•SDLMixer - http://libsdl.org/projects/SDL_mixer
•Freetype - http://freetype.org•DeviL - http://openil.sourceforge.net•PhysicsFS - http://icculus.org/physfs•BOX2D - http://box2d.org•Boost - http://boost.org•SWIG - http://swig.org
![Page 6: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/6.jpg)
6
Componentes
•Graphics•Audio•Physics•Mouse•Keyboard
•Joystick•Filesystem•Timer•System
![Page 7: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/7.jpg)
7
Quase 09:10
Show me the code !
![Page 8: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/8.jpg)
8
LÖVE hello worldfunction load() love.graphics.setBackgroundColor(54, 172, 248) love.graphics.setColor(255, 255, 255)
local f = love.graphics.newFont(love.default_font, 14)
love.graphics.setFont(f)end
function draw() love.graphics.draw("hello", 50, 50)end
![Page 9: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/9.jpg)
9
Mandamentos• Tenha um main.lua• Crie as funções
▫ Load()▫ Update(dt)▫ Draw()
E se precisar implemente alguma destas:▫ Mousepressed()▫ Mousereleased()▫ Keypressed()▫ Keyreleased()▫ Joystickpressed()▫ Joystickreleased()
![Page 10: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/10.jpg)
10
Movendo a bolafunction load()
branco = love.graphics.newColor( 255, 255, 255 )
love.graphics.setBackgroundColor( branco )bola = love.graphics.newImage("bola.png")x = 100y = 100velocidade = 240
end
function draw()love.graphics.draw( bola, x, y )
end
function update(delta)
if love.keyboard.isDown(love.key_up) then
y = y - (velocidade * delta)end
if love.keyboard.isDown(love.key_down) then
y = y + (velocidade * delta)end
if love.keyboard.isDown(love.key_left) then
x = x - (velocidade * delta)end
if love.keyboard.isDown(love.key_right) then
x = x + (velocidade * delta)end
end
![Page 11: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/11.jpg)
11
Outros exemplos
![Page 12: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/12.jpg)
12
Mais exemplos
![Page 13: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/13.jpg)
13
Referências
•http://love2d.org/docs/•http://love2d.org/forum/
•www.riogdug.org•www.athanazio.com/jogos
![Page 14: Jogos Em Lua Com LöVe](https://reader036.vdocuments.pub/reader036/viewer/2022062303/556218f2d8b42acb1e8b5297/html5/thumbnails/14.jpg)
14
Make LÖVE !