루아(LUA)/마이크로스튜디오

똥 피하기(Avoiding poop) 게임을 만들어 보자 [마이크로 스튜디오#4]

JK77 2022. 1. 20. 17:58

똥 피하기 게임을 마이크로 스튜디오에서 만들어 보자.

Avoiding poop_game

1. 똥 이미지 준비.

똥 피하기
똥이 내려온다.

코드:

init = function()
  yPos=0
  --xPos=math.random()*screen.width/2-math.random()*screen.width/2
  poop={}
end

update = function()
  yPos = yPos+1
  xPos=math.random()*screen.width/2-math.random()*screen.width/2
  --if xPos>180 then
  --print(xPos)
  --end
end

draw = function()
  screen:clear(-1)
  screen:drawSprite("poop",xPos,100-yPos,15,15)
end