1 / 14

Jogos em Lua com LÖVE

Jogos em Lua com LÖVE. Hamilton Lima Jr. MediaLab – UFF www.athanazio.com Lua workshop 2009. Agenda. O que é LÖVE Componentes Exemplos Hello world Controle de teclado Fisica Jogos completos. O que é LÖVE. Game engine 2D Usa LUA como linguagem de programação

johnna
Download Presentation

Jogos em Lua com LÖVE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jogos em Lua com LÖVE Hamilton Lima Jr. MediaLab – UFF www.athanazio.com Lua workshop 2009

  2. Agenda • O que é LÖVE • Componentes • Exemplos • Hello world • Controle de teclado • Fisica • Jogos completos

  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 

  4. “LÖVE is an unquestionably awesome 2D game engine, which allows rapid game development and prototyping in Lua“ http://love2d.org

  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

  6. Componentes • Graphics • Audio • Physics • Mouse • Keyboard • Joystick • Filesystem • Timer • System

  7. Quase 09:10 Show me the code !

  8. LÖVE hello world function 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

  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()

  10. Movendo a bola function load() branco = love.graphics.newColor( 255, 255, 255 ) love.graphics.setBackgroundColor( branco ) bola = love.graphics.newImage("bola.png") x = 100 y = 100 velocidade = 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

  11. Outros exemplos

  12. Mais exemplos

  13. Referências • http://love2d.org/docs/ • http://love2d.org/forum/ • www.riogdug.org • www.athanazio.com/jogos

  14. Make LÖVE !

More Related