Skip to content

Commit

Permalink
uploading game
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoa committed Mar 9, 2019
0 parents commit 454c842
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 0 deletions.
Binary file added 1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions Drop.lua
@@ -0,0 +1,46 @@
Drop = {}

Drop.new = function()
local self = {}

self.x = love.math.random(128, 512)
self.y = love.math.random(100) * - 1
self.yv = love.math.random(200, 400)

self.draw = function()
love.graphics.rectangle("fill", self.x, self.y, 5, 30)
end

self.update = function(dt)
self.y = self.y + self.yv * dt
if self.y > 256 then
self.y = love.math.random(100) * - 1
self.x = love.math.random(128, 512)
self.yv = love.math.random(200, 400)
end
end

self.mouseUpdate = function(x, y)
if x > self.x and x < self.x + 5 and y > self.y and y < self.y + 30 then
self.y = love.math.random(100) * - 1
self.x = love.math.random(128, 512)
growth = growth + 1
if not sans then
if growth == 27 then
music:stop()
sans = love.audio.newSource("oof.mp3", "static")
currentImg = currentImg + 1
sans:setLooping(true)
sans:play()
elseif growth % 3 == 0 then
if currentImg < 10 then
currentImg = currentImg + 1
end
end
end

end
end

return self
end
6 changes: 6 additions & 0 deletions conf.lua
@@ -0,0 +1,6 @@
function love.conf(t)
t.window.title = "starting small | click the raindrops to grow your tree"
t.window.height = 256
t.window.icon = "1.png"
t.window.width = 512
end
45 changes: 45 additions & 0 deletions main.lua
@@ -0,0 +1,45 @@
function love.load()
require("Drop")
love.graphics.setDefaultFilter("nearest", "nearest", 1)
growthimgs = {}
for i = 1, 10 do
table.insert(growthimgs, love.graphics.newImage(i..".png"))
end
currentImg = 1

imgtext = {"seed", "grass", "greenery", "plants!", "splits", "branches", "?", "!", "?!!?!?", "sans"}

rain = {}

for i = 1, 20 do
table.insert(rain, Drop.new())
end
growth = 0

music = love.audio.newSource("music.mp3", "stream")
music:setLooping(true)
music:play()
end

function love.draw()
love.graphics.draw(growthimgs[currentImg], 0, 0, 0, 4, 4)
love.graphics.printf(imgtext[currentImg], 128, 128, 100)
for k, drop in ipairs(rain) do
drop.draw()
end
end

function love.update(dt)
for k, drop in ipairs(rain) do
drop.update(dt)
end
if love.keyboard.isDown("escape") then
love.event.quit()
end
end

function love.mousepressed(x, y)
for k, drop in ipairs(rain) do
drop.mouseUpdate(x, y)
end
end
Binary file added music.mp3
Binary file not shown.
Binary file added oof.mp3
Binary file not shown.

0 comments on commit 454c842

Please sign in to comment.