1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- -- vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 autoindent:
- local init = {}
- function init.load()
- --love.window.setMode(800, 600, {resizable=true, vsync=false, minwidth=400, minheight=300})
- p1_keyleft = "h"
- p1_keyright = "j"
- p2_keyleft = "left"
- p2_keyright = "right"
- game_keyquit = "escape"
- -- We expect the window's size not to change
- maxWidth = love.graphics.getWidth( )
- maxHeight = love.graphics.getHeight( )
-
- -- Rendering
- love.graphics.setBlendMode("additive")
- -- Canvas
- canvas = love.graphics.newCanvas(maxWidth, maxHeight)
- love.graphics.setCanvas(canvas)
- canvas:clear()
- -- Some colors
- text_color = {250, 250, 250, 255}
- bg_color = {10, 10, 29, 255}
- border_color = {15, 15, 255, 255}
- -- Player's colors
- p1_color = {255, 20, 20, 255}
- p2_color = {20, 255, 20, 255}
- -- Player's states
- p1_state = "alive"
- p2_state = "alive"
- -- Player's starting directions
- p1_direction = "right"
- p2_direction = "left"
- -- Player's starting points
- x1, y1 = maxWidth / 4, maxHeight / 2
- x2, y2 = maxWidth - maxWidth / 4, maxHeight / 2
- -- setting up collision array
- collisionArray = {}
- for dummyX = 1,maxWidth do
- collisionArray[dummyX] = {}
- for dummyY = 1,maxHeight do
- collisionArray[dummyX][dummyY] = 0
- end
- end
- end
-
- return init
|