mirror of
https://github.com/libretro/lutro-platformer.git
synced 2024-11-24 00:29:40 +00:00
Add parallaxe effect
This commit is contained in:
parent
4774362047
commit
3729630b3e
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 9.5 KiB |
10
main.lua
10
main.lua
@ -15,6 +15,8 @@ local add_entity_from_map = function(object)
|
||||
end
|
||||
|
||||
function lutro.load()
|
||||
bg1 = lutro.graphics.newImage(lutro.path .. "assets/forestbackground.png")
|
||||
bg2 = lutro.graphics.newImage(lutro.path .. "assets/foresttrees.png")
|
||||
map = tiled_load(lutro.path .. "assets/pagode.json")
|
||||
tiled_load_objects(map, add_entity_from_map)
|
||||
table.insert(entities, newNinja())
|
||||
@ -31,6 +33,14 @@ end
|
||||
|
||||
function lutro.draw()
|
||||
lutro.graphics.clear(0xff000000)
|
||||
|
||||
for i=0, 1 do
|
||||
lutro.graphics.draw(bg1.data,
|
||||
i*bg1.width + lutro.camera_x/6, 0, bg1.width, bg1.height)
|
||||
lutro.graphics.draw(bg2.data,
|
||||
i*bg2.width + lutro.camera_x/3, 0, bg2.width, bg2.height)
|
||||
end
|
||||
|
||||
tiled_draw_layer(map.layers[1])
|
||||
for i=1, #entities do
|
||||
if entities[i].draw then
|
||||
|
Loading…
Reference in New Issue
Block a user