본문 바로가기
루아(LUA)/마이크로스튜디오

움직이는 바닥위에 장애물 만들고 화면에서 사라지면 나타나게 하기 [마이크로 스튜디오#2]

by JK77 2022. 1. 20.

init = function()
  position = 0
  scrW = screen.width/2
  blade ={scrW,scrW+100,scrW+200}
end

update = function()
  position = position + 1
  
  if blade[1]<position-scrW then
    print("사라짐")
    blade[1]=position+scrW
    print(blade[1])
  end
end

draw = function()
  screen:clear(-10)
  for i= -10,10 do
    screen:drawSprite("wall",i*50-position%50,-76,50)
  end
  
 -- for i=1,#blade do
    screen:drawSprite("blade",blade[1]-position,-38, 50)
 -- end
  
  
end