init.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. -- vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 autoindent:
  2. local init = {}
  3. function init.load()
  4. --love.window.setMode(800, 600, {resizable=true, vsync=false, minwidth=400, minheight=300})
  5. p1_keyleft = "h"
  6. p1_keyright = "j"
  7. p2_keyleft = "left"
  8. p2_keyright = "right"
  9. game_keyquit = "escape"
  10. -- We expect the window's size not to change
  11. maxWidth = love.graphics.getWidth( )
  12. maxHeight = love.graphics.getHeight( )
  13. -- Rendering
  14. love.graphics.setBlendMode("additive")
  15. -- Canvas
  16. canvas = love.graphics.newCanvas(maxWidth, maxHeight)
  17. love.graphics.setCanvas(canvas)
  18. canvas:clear()
  19. -- Some colors
  20. text_color = {250, 250, 250, 255}
  21. bg_color = {10, 10, 29, 255}
  22. border_color = {15, 15, 255, 255}
  23. -- Player's colors
  24. p1_color = {255, 20, 20, 255}
  25. p2_color = {20, 255, 20, 255}
  26. -- Player's states
  27. p1_state = "alive"
  28. p2_state = "alive"
  29. -- Player's starting directions
  30. p1_direction = "right"
  31. p2_direction = "left"
  32. -- Player's starting points
  33. x1, y1 = maxWidth / 4, maxHeight / 2
  34. x2, y2 = maxWidth - maxWidth / 4, maxHeight / 2
  35. -- setting up collision array
  36. collisionArray = {}
  37. for dummyX = 1,maxWidth do
  38. collisionArray[dummyX] = {}
  39. for dummyY = 1,maxHeight do
  40. collisionArray[dummyX][dummyY] = 0
  41. end
  42. end
  43. end
  44. return init