Coffeescript Game Tutorial Add a Paddle 2014-07-29 ProgrammingCoffeeScript CoffeeScript, Game, Programming 화면 하단에 막대기를 추가한 코드이다. 1234567891011121314151617181920212223242526272829paddlex = 0paddleh = 0paddlew = 0init_paddle = ->paddlex = WIDTH / 2paddleh = 10paddlew = 75draw = ->clear()circle(x, y, 10)rect(paddlex, HEIGHT - paddleh, paddlew, paddleh)dx = -dx if x + dx > WIDTH or x + dx < 0if y + dy < 0dy = -dyelse if y + dy > HEIGHTif x > paddlex and x < paddlex + paddlewdy = -dyelseclearInterval(intervalId)x += dx;y += dy;window.onload = ->init()init_paddle() Reference Newer Coffeescript Game Tutorial Bounce Older Coffeescript Game Tutorial the Keyboard