local v=require("\114\097\121\108\105\098")local M=800 local O=450 v.InitWindow(M,O,"\114\097\121\108\105\098 \091\116\101\120\116\117\114\101\115\093 \101\120\097\109\112\108\101 - \098\097\099\107\103\114\111\117\110\100 \115\099\114\111\108\108\105\110\103")v.SetTargetFPS(60)local U=v.LoadTexture("\101\120\097\109\112\108\101\115\047\114\101\115\111\117\114\099\101\115\047\099\121\098\101\114\112\117\110\107\095\115\116\114\101\101\116\095\098\097\099\107\103\114\111\117\110\100\046\112\110\103")local J=v.LoadTexture("\101\120\097\109\112\108\101\115\047\114\101\115\111\117\114\099\101\115\047\099\121\098\101\114\112\117\110\107\095\115\116\114\101\101\116\095\109\105\100\103\114\111\117\110\100\046\112\110\103")local W=v.LoadTexture("\101\120\097\109\112\108\101\115\047\114\101\115\111\117\114\099\101\115\047\099\121\098\101\114\112\117\110\107\095\115\116\114\101\101\116\095\102\111\114\101\103\114\111\117\110\100\046\112\110\103")local K=.0 local F=.0 local z=.0 while not v.WindowShouldClose()do K=K-.1 F=F-.5 z=z-1.0 if K<=-U.width*2 then K=0 end if F<=-J.width*2 then F=0 end if z<=-W.width*2 then z=0 end v.BeginDrawing()v.ClearBackground(v.GetColor(86787839))v.ClearBackground(v.RAYWHITE)v.DrawTextureEx(U,v.Vector2(K,20),.0,2.0,v.WHITE)v.DrawTextureEx(U,v.Vector2(U.width*2+K,20),.0,2.0,v.WHITE)v.DrawTextureEx(J,v.Vector2(F,20),.0,2.0,v.WHITE)v.DrawTextureEx(J,v.Vector2(J.width*2+F,20),.0,2.0,v.WHITE)v.DrawTextureEx(W,v.Vector2(z,70),.0,2.0,v.WHITE)v.DrawTextureEx(W,v.Vector2(W.width*2+z,70),.0,2.0,v.WHITE)v.DrawText("\066\065\067\075\071\082\079\085\078\068 \083\067\082\079\076\076\073\078\071 \038 \080\065\082\065\076\076\065\088",10,10,20,v.RED)v.DrawText("\040\099\041 \067\121\098\101\114\112\117\110\107 \083\116\114\101\101\116 \069\110\118\105\114\111\110\109\101\110\116 \098\121 \076\117\105\115 \090\117\110\111 \040\064\097\110\115\105\109\117\122\041",M-330,O-20,10,v.RAYWHITE)v.EndDrawing()end v.UnloadTexture(U)v.UnloadTexture(J)v.UnloadTexture(W)v.CloseWindow()
local rl = require("raylib")

local screenWidth = 800
local screenHeight = 450

rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - background scrolling")
rl.SetTargetFPS(60)

local background = rl.LoadTexture("examples/resources/cyberpunk_street_background.png")
local midground = rl.LoadTexture("examples/resources/cyberpunk_street_midground.png")
local foreground = rl.LoadTexture("examples/resources/cyberpunk_street_foreground.png")

local scrollingBack = 0.0
local scrollingMid = 0.0
local scrollingFore = 0.0

while not rl.WindowShouldClose() do
  scrollingBack = scrollingBack - 0.1
  scrollingMid = scrollingMid - 0.5
  scrollingFore = scrollingFore - 1.0

  if scrollingBack <= -background.width * 2 then
    scrollingBack = 0
  end

  if scrollingMid <= -midground.width * 2 then
    scrollingMid = 0
  end

  if scrollingFore <= -foreground.width * 2 then
    scrollingFore = 0
  end

  rl.BeginDrawing()

  rl.ClearBackground(rl.GetColor(0x052c46ff))
  rl.ClearBackground(rl.RAYWHITE)

  -- Draw background image twice
  -- NOTE: Texture is scaled twice its size
  rl.DrawTextureEx(background, rl.Vector2(scrollingBack, 20), 0.0, 2.0, rl.WHITE)
  rl.DrawTextureEx(background, rl.Vector2(background.width * 2 + scrollingBack, 20), 0.0, 2.0, rl.WHITE)

  --Draw midground image twice
  rl.DrawTextureEx(midground, rl.Vector2(scrollingMid, 20), 0.0, 2.0, rl.WHITE)
  rl.DrawTextureEx(midground, rl.Vector2(midground.width * 2 + scrollingMid, 20), 0.0, 2.0, rl.WHITE)

  -- Draw foreground image twice
  rl.DrawTextureEx(foreground, rl.Vector2(scrollingFore, 70), 0.0, 2.0, rl.WHITE)
  rl.DrawTextureEx(foreground, rl.Vector2(foreground.width * 2 + scrollingFore, 70), 0.0, 2.0, rl.WHITE)

  rl.DrawText("BACKGROUND SCROLLING & PARALLAX", 10, 10, 20, rl.RED)
  rl.DrawText(
    "(c) Cyberpunk Street Environment by Luis Zuno (@ansimuz)",
    screenWidth - 330,
    screenHeight - 20,
    10,
    rl.RAYWHITE
  )

  rl.EndDrawing()
end

rl.UnloadTexture(background)
rl.UnloadTexture(midground)
rl.UnloadTexture(foreground)

rl.CloseWindow()
