Skip to content

Instantly share code, notes, and snippets.

@neslinesli93
Last active January 2, 2020 21:29
Show Gist options
  • Save neslinesli93/5ccc17606454b90f3b6abea27615c9de to your computer and use it in GitHub Desktop.
Save neslinesli93/5ccc17606454b90f3b6abea27615c9de to your computer and use it in GitHub Desktop.
Main template
<div class="game-container">
<%= for block <- @blocks, block.type in [:wall, :floor] do %>
<div class="block <%= block.type %>"
style="transform: translate3d(<%= block.left %>px, <%= block.top %>px, 0px);
width: <%= block.width %>px;
height: <%= block.height %>px; "></div>
<% end %>
<%= for brick <- @blocks, brick.type == :brick and brick.visible == true do %>
<div class="block brick"
style="transform: translate3d(<%= brick.left %>px, <%= brick.top %>px, 0px);
width: <%= brick.width %>px;
height: <%= brick.height %>px;
background: <%= Map.fetch!(brick, :color) %>; "></div>
<% end %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment