summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--assets/asteroids.pngbin0 -> 1227 bytes
-rw-r--r--assets/backgrounds/menu.pngbin13640 -> 11447 bytes
-rw-r--r--assets/stars.pngbin0 -> 1644 bytes
-rw-r--r--menu.lua19
4 files changed, 18 insertions, 1 deletions
diff --git a/assets/asteroids.png b/assets/asteroids.png
new file mode 100644
index 0000000..cb85a2b
--- /dev/null
+++ b/assets/asteroids.png
Binary files differ
diff --git a/assets/backgrounds/menu.png b/assets/backgrounds/menu.png
index 9be3233..b42f8f6 100644
--- a/assets/backgrounds/menu.png
+++ b/assets/backgrounds/menu.png
Binary files differ
diff --git a/assets/stars.png b/assets/stars.png
new file mode 100644
index 0000000..4965389
--- /dev/null
+++ b/assets/stars.png
Binary files differ
diff --git a/menu.lua b/menu.lua
index b72ea09..36e06ef 100644
--- a/menu.lua
+++ b/menu.lua
@@ -12,6 +12,10 @@ Menu = {
music,
sprite,
background,
+ asteroids,
+ stars,
+ asteroids_bounce = 0,
+ stars_timer = 0,
allowMove = true,
quads = {
button = {
@@ -28,6 +32,10 @@ Menu = {
},
arrow_l = love.graphics.newQuad(68, 0, 6, 6, 80,130),
arrow_r = love.graphics.newQuad(74, 0, 6, 6, 80,130),
+ stars = {
+ love.graphics.newQuad( 0, 0, 320, 200, 640,200),
+ love.graphics.newQuad(320, 0, 320, 200, 640,200)
+ },
}
}
function Menu:new(name)
@@ -36,6 +44,8 @@ function Menu:new(name)
self.__index = self
self.sprite = love.graphics.newImage("assets/menu.png")
self.background = love.graphics.newImage("assets/backgrounds/menu.png")
+ self.asteroids = love.graphics.newImage("assets/asteroids.png")
+ self.stars = love.graphics.newImage("assets/stars.png")
o.elements = {}
o:load(name)
o.music = Music:new("menu.ogg")
@@ -84,10 +94,17 @@ function Menu:update(dt)
for _,element in pairs(self.elements) do
element:update(dt)
end
+ self.asteroids_bounce = self.asteroids_bounce + dt*0.1
+ if self.asteroids_bounce > 2 then self.asteroids_bounce = self.asteroids_bounce - 2 end
+ self.stars_timer = self.stars_timer + dt * 0.7
+ if self.stars_timer > 2 then self.stars_timer = self.stars_timer - 2 end
end
function Menu:draw()
local scale = self.scale
- love.graphics.draw(self.background, 0, 0, 0, getRealScale(), getRealScale())
+ local scaler = getRealScale()
+ love.graphics.draw(self.background, 0, 0, 0, scaler, scaler)
+ love.graphics.draw(self.stars, self.quads.stars[math.ceil(self.stars_timer)], 0, 0, 0, scaler, scaler)
+ love.graphics.draw(self.asteroids, 0, math.floor(64+math.sin(self.asteroids_bounce*math.pi)*4)*scaler, 0, scaler, scaler)
love.graphics.setFont(Font)
for _,element in pairs(self.elements) do
element:draw(scale)