Update moon
This commit is contained in:
@ -12,7 +12,7 @@ function asteroids.load(game)
|
||||
}
|
||||
asteroids.num = game.level * 5
|
||||
asteroids.max_speed = 5
|
||||
-- Generate asteroids
|
||||
-- Make asteroids
|
||||
asteroids.bodys = {}
|
||||
for i = 1, asteroids.num do
|
||||
make_asteroid(i, game, true)
|
||||
|
32
assets/scripts/moon.lua
Normal file
32
assets/scripts/moon.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local tools = require 'assets/scripts/tools'
|
||||
|
||||
moon = {}
|
||||
|
||||
function moon.load(game)
|
||||
local imgs = {
|
||||
love.graphics.newImage('assets/sprites/moon/body1.png'),
|
||||
love.graphics.newImage('assets/sprites/moon/body2.png'),
|
||||
love.graphics.newImage('assets/sprites/moon/body3.png')
|
||||
}
|
||||
moon.img = imgs[math.random(1, tools.table_length(imgs))]
|
||||
moon.x = 0
|
||||
moon.y = game.canvas.height - moon.img:getHeight()
|
||||
moon.bodys = {}
|
||||
-- Repeat
|
||||
if moon.img:getWidth() < game.window.width then
|
||||
for i = 1, math.ceil(game.window.width / moon.img:getWidth()) do
|
||||
moon.bodys[i] = (i - 1) * moon.img:getWidth()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function moon.update()
|
||||
end
|
||||
|
||||
function moon.draw(game)
|
||||
for key, tile in pairs(moon.bodys) do
|
||||
love.graphics.draw(moon.img, tile, moon.y)
|
||||
end
|
||||
end
|
||||
|
||||
return moon
|
BIN
assets/sprites/moon/body1.png
Executable file
BIN
assets/sprites/moon/body1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
assets/sprites/moon/body2.png
Executable file
BIN
assets/sprites/moon/body2.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
assets/sprites/moon/body3.png
Executable file
BIN
assets/sprites/moon/body3.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
Reference in New Issue
Block a user