~jhpotter/photon

8f965b2c61652df4451c2be03a9c6d2027258262 — Jeremy Potter 6 months ago master
Initial commit
4 files changed, 49 insertions(+), 0 deletions(-)

A README.md
A main.lua
A textures/asphalt.png
A textures/zoomer.png
A  => README.md +12 -0
@@ 1,12 @@
# Photon

## Dependencies

* Lua
* LÖVE

## Running

```sh
$ love .
```

A  => main.lua +37 -0
@@ 1,37 @@
function love.load()
  -- Scale up pixel art without blurriness
  love.graphics.setDefaultFilter("nearest", "nearest", 1)

  textures = {
    ["zoomer"] = love.graphics.newImage("textures/zoomer.png"),
    ["asphalt"] = love.graphics.newImage("textures/asphalt.png") 
  }

  player = {
    ["x"] = 0,
    ["y"] = 0
  }
end

function love.update(dt)
  if love.keyboard.isDown("w") and not love.keyboard.isDown("s") then
    player.y = player.y - (200 * dt)
  elseif love.keyboard.isDown("s") then
    player.y = player.y + (200 * dt)
  end
  if love.keyboard.isDown("a") and not love.keyboard.isDown("d") then
    player.x = player.x - (200 * dt)
  elseif love.keyboard.isDown("d") then
    player.x = player.x + (200 * dt)
  end
end

function love.draw()
  for y=1, love.graphics.getHeight(), 80 do
    for x=1, love.graphics.getWidth(), 80 do
      love.graphics.draw(textures.asphalt, x, y, 0, 10)
    end
  end

  love.graphics.draw(textures.zoomer, player.x, player.y, 0, 3)
end

A  => textures/asphalt.png +0 -0
A  => textures/zoomer.png +0 -0