Created
January 2, 2020 21:00
-
-
Save neslinesli93/e004521d430dd5c05e89b817e4313e79 to your computer and use it in GitHub Desktop.
Enrich mount function with paddle state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mount(_session, socket) do | |
state = %{ | |
unit: @unit, | |
tick: @tick, | |
paddle: %{ | |
width: @paddle_length * @unit, | |
height: @paddle_height * @unit, | |
# Coordinates of the box surrounding the paddle | |
left: Helpers.coordinate(@paddle_left, @unit), | |
top: Helpers.coordinate(@paddle_top, @unit), | |
right: Helpers.coordinate(@paddle_left + @paddle_length, @unit), | |
bottom: Helpers.coordinate(@paddle_top + @paddle_height, @unit), | |
# Misc | |
direction: :stationary, | |
speed: @paddle_speed, | |
length: @paddle_length | |
} | |
} | |
# ...other code below | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment