diff --git a/lua/simple_test/avalanche/big_love_ball.png b/lua/simple_test/avalanche/big_love_ball.png new file mode 100644 index 0000000..b2eab33 Binary files /dev/null and b/lua/simple_test/avalanche/big_love_ball.png differ diff --git a/lua/simple_test/avalanche/bla.love b/lua/simple_test/avalanche/bla.love new file mode 100644 index 0000000..0e84ac2 Binary files /dev/null and b/lua/simple_test/avalanche/bla.love differ diff --git a/lua/simple_test/avalanche/conf.lua b/lua/simple_test/avalanche/conf.lua new file mode 100644 index 0000000..c9b6166 --- /dev/null +++ b/lua/simple_test/avalanche/conf.lua @@ -0,0 +1,3 @@ +function love.conf(t) + t.title = "Avalanche of LÖVE" +end \ No newline at end of file diff --git a/lua/simple_test/avalanche/green_ball.png b/lua/simple_test/avalanche/green_ball.png new file mode 100644 index 0000000..44c3928 Binary files /dev/null and b/lua/simple_test/avalanche/green_ball.png differ diff --git a/lua/simple_test/avalanche/love_ball.png b/lua/simple_test/avalanche/love_ball.png new file mode 100644 index 0000000..1298f64 Binary files /dev/null and b/lua/simple_test/avalanche/love_ball.png differ diff --git a/lua/simple_test/avalanche/main.lua b/lua/simple_test/avalanche/main.lua new file mode 100644 index 0000000..e9e99dc --- /dev/null +++ b/lua/simple_test/avalanche/main.lua @@ -0,0 +1,98 @@ +-- Example: Avalanche of LOVE + +-- Contains all the balls. +balls = {} + +-- Contains all the boxes. (Terrain) +boxes = {} + +function love.load() + + -- Fat lines. + love.graphics.setLineWidth(2) + + -- Load images. + images = { + green = love.graphics.newImage("green_ball.png"), + big_love = love.graphics.newImage("big_love_ball.png"), + love = love.graphics.newImage("love_ball.png"), + } + + -- Image / radius pairs. + balldefs = { + { i = images.green, r = 32 , ox = 36, oy = 36}, + { i = images.big_love, r = 46 , ox = 48, oy = 48}, + { i = images.love, r = 28 , ox = 32, oy = 32}, + } + + -- Create the world. + world = love.physics.newWorld(0, 300) + + -- Create ground body. + ground = love.physics.newBody(world, 0, 0, "static") + + -- Add all the balls. + addball(balldefs[1], 50) -- Add 100 green. + addball(balldefs[2], 5) -- Add 5 big. + addball(balldefs[3], 25) -- Add 50 pink. + + -- This generates the terrain. + for i = 0, 10 do + addbox(i*50, i*50+100) + end + +end + +function love.update(dt) + + -- Update the world. + world:update(dt) + + -- Check whether we need to reset some balls. + -- When they move out of the screen, they + -- respawn above the screen. + for i,v in ipairs(balls) do + local x, y = v.b:getPosition() + if x > 850 or y > 650 then + v.b:setPosition(math.random(600, 1400), -math.random(100, 1500)) + v.b:setLinearVelocity(-math.random(100,1000), math.random(100,1000)) + end + end +end + +function love.draw() + -- Draw all the balls. + for i, v in ipairs(balls) do + love.graphics.draw(v.i, v.b:getX(), v.b:getY(), v.b:getAngle(), 1, 1, v.ox, v.oy) + end + -- Draw all the boxes. + for i, v in ipairs(boxes) do + love.graphics.polygon("line", v.s:getPoints()) + end + love.graphics.print("Click and drag the cake around or use the arrow keys", 10, 10) +end + +-- Adds a static box. +function addbox(x, y) + local t = {} + t.b = ground + t.s = love.physics.newRectangleShape(x, y, 50, 50) + t.f = love.physics.newFixture(t.b, t.s) + table.insert(boxes, t) +end + + +-- Adds X balls. +function addball(def, num) + for i = 1, num do + local x, y = math.random(0, 400), -math.random(100, 1500) + local t = {} + t.b = love.physics.newBody(world, x, y, "dynamic") + t.s = love.physics.newCircleShape(def.r) + t.f = love.physics.newFixture(t.b, t.s) + t.i = def.i + t.ox = def.ox + t.oy = def.oy + table.insert(balls, t) + end +end diff --git a/lua/simple_test/lovalanche.love b/lua/simple_test/lovalanche.love new file mode 100644 index 0000000..68b14a4 Binary files /dev/null and b/lua/simple_test/lovalanche.love differ diff --git a/lua/simple_test/love/avalanche/big_love_ball.png b/lua/simple_test/love/avalanche/big_love_ball.png new file mode 100644 index 0000000..b2eab33 Binary files /dev/null and b/lua/simple_test/love/avalanche/big_love_ball.png differ diff --git a/lua/simple_test/love/avalanche/conf.lua b/lua/simple_test/love/avalanche/conf.lua new file mode 100644 index 0000000..c9b6166 --- /dev/null +++ b/lua/simple_test/love/avalanche/conf.lua @@ -0,0 +1,3 @@ +function love.conf(t) + t.title = "Avalanche of LÖVE" +end \ No newline at end of file diff --git a/lua/simple_test/love/avalanche/green_ball.png b/lua/simple_test/love/avalanche/green_ball.png new file mode 100644 index 0000000..44c3928 Binary files /dev/null and b/lua/simple_test/love/avalanche/green_ball.png differ diff --git a/lua/simple_test/love/avalanche/lovalanche.love b/lua/simple_test/love/avalanche/lovalanche.love new file mode 100644 index 0000000..68b14a4 Binary files /dev/null and b/lua/simple_test/love/avalanche/lovalanche.love differ diff --git a/lua/simple_test/love/avalanche/love_ball.png b/lua/simple_test/love/avalanche/love_ball.png new file mode 100644 index 0000000..1298f64 Binary files /dev/null and b/lua/simple_test/love/avalanche/love_ball.png differ diff --git a/lua/simple_test/love/avalanche/main.lua b/lua/simple_test/love/avalanche/main.lua new file mode 100644 index 0000000..fbe61cb --- /dev/null +++ b/lua/simple_test/love/avalanche/main.lua @@ -0,0 +1,98 @@ +-- Example: Avalanche of LOVE + +-- Contains all the balls. +balls = {} + +-- Contains all the boxes. (Terrain) +boxes = {} + +function love.load() + + -- Fat lines. + love.graphics.setLineWidth(2) + + -- Load images. + images = { + green = love.graphics.newImage("green_ball.png"), + big_love = love.graphics.newImage("big_love_ball.png"), + love = love.graphics.newImage("love_ball.png"), + } + + -- Image / radius pairs. + balldefs = { + { i = images.green, r = 32 , ox = 36, oy = 36}, + { i = images.big_love, r = 46 , ox = 48, oy = 48}, + { i = images.love, r = 28 , ox = 32, oy = 32}, + } + + -- Create the world. + world = love.physics.newWorld(0, 50) + + -- Create ground body. + ground = love.physics.newBody(world, 0, 0, "static") + + -- Add all the balls. + addball(balldefs[1], 50) -- Add 100 green. + addball(balldefs[2], 5) -- Add 5 big. + addball(balldefs[3], 25) -- Add 50 pink. + + -- This generates the terrain. + for i = 0, 10 do + addbox(i*50, i*50+100) + end + +end + +function love.update(dt) + + -- Update the world. + world:update(dt) + + -- Check whether we need to reset some balls. + -- When they move out of the screen, they + -- respawn above the screen. + for i,v in ipairs(balls) do + local x, y = v.b:getPosition() + if x > 850 or y > 650 then + v.b:setPosition(math.random(0, 400), -math.random(100, 1500)) + v.b:setLinearVelocity(0, 0) + end + end + +end + +function love.draw() + -- Draw all the balls. + for i, v in ipairs(balls) do + love.graphics.draw(v.i, v.b:getX(), v.b:getY(), v.b:getAngle(), 1, 1, v.ox, v.oy) + end + -- Draw all the boxes. + for i, v in ipairs(boxes) do + love.graphics.polygon("line", v.s:getPoints()) + end +end + +-- Adds a static box. +function addbox(x, y) + local t = {} + t.b = ground + t.s = love.physics.newRectangleShape(x, y, 50, 50) + t.f = love.physics.newFixture(t.b, t.s) + table.insert(boxes, t) +end + + +-- Adds X balls. +function addball(def, num) + for i = 1, num do + local x, y = math.random(0, 400), -math.random(100, 1500) + local t = {} + t.b = love.physics.newBody(world, x, y, "dynamic") + t.s = love.physics.newCircleShape(def.r) + t.f = love.physics.newFixture(t.b, t.s) + t.i = def.i + t.ox = def.ox + t.oy = def.oy + table.insert(balls, t) + end +end diff --git a/lua/simple_test/love/love-demos-0.8.0.zip b/lua/simple_test/love/love-demos-0.8.0.zip new file mode 100644 index 0000000..4e897c9 Binary files /dev/null and b/lua/simple_test/love/love-demos-0.8.0.zip differ diff --git a/lua/simple_test/love/metaballs.love b/lua/simple_test/love/metaballs.love new file mode 100644 index 0000000..0f4c192 Binary files /dev/null and b/lua/simple_test/love/metaballs.love differ diff --git a/lua/simple_test/love/no.love b/lua/simple_test/love/no.love new file mode 100644 index 0000000..bc6acd6 Binary files /dev/null and b/lua/simple_test/love/no.love differ diff --git a/lua/simple_test/love/passingclouds.love b/lua/simple_test/love/passingclouds.love new file mode 100644 index 0000000..7e4ce1a Binary files /dev/null and b/lua/simple_test/love/passingclouds.love differ diff --git a/lua/simple_test/love/sinescroller.love b/lua/simple_test/love/sinescroller.love new file mode 100644 index 0000000..1ba5335 Binary files /dev/null and b/lua/simple_test/love/sinescroller.love differ diff --git a/lua/simple_test/test1/bla.love b/lua/simple_test/test1/bla.love new file mode 100644 index 0000000..45e6a13 Binary files /dev/null and b/lua/simple_test/test1/bla.love differ diff --git a/lua/simple_test/test1/cloud.png b/lua/simple_test/test1/cloud.png new file mode 100644 index 0000000..59ec679 Binary files /dev/null and b/lua/simple_test/test1/cloud.png differ diff --git a/lua/simple_test/test1/conf.lua b/lua/simple_test/test1/conf.lua new file mode 100644 index 0000000..e7dbe2d --- /dev/null +++ b/lua/simple_test/test1/conf.lua @@ -0,0 +1,4 @@ + +function love.conf(t) + t.title = "ParticleSystem Demo" +end diff --git a/lua/simple_test/test1/main.lua b/lua/simple_test/test1/main.lua new file mode 100644 index 0000000..d524b5a --- /dev/null +++ b/lua/simple_test/test1/main.lua @@ -0,0 +1,31 @@ +------------------------------------------------- +-- LOVE: ParticleSystem demo. +-- Website: http://love2d.org +-- Licence: ZLIB/libpng +-- Copyright (c) 2006-2009 LOVE Development Team +------------------------------------------------- + +systems = {} +current = 1 + +function love.load() + cloud = love.graphics.newImage("cloud.png") + x = 50 + y = 50 +end + +function love.draw() + love.graphics.draw(cloud, x, y) +end + +function love.update(dt) + if love.keyboard.isDown("up") then + y = y - 1000 * dt + elseif love.keyboard.isDown("down") then + y = y + 1000 * dt + elseif love.keyboard.isDown("right") then + x = x + 1000 * dt + elseif love.keyboard.isDown("left") then + x = x - 1000 * dt + end +end