101 lines
2.4 KiB
Lua
101 lines
2.4 KiB
Lua
--Version 2.1 dated 2013-06-21
|
|
|
|
--CeCILL Copyright (C) 2022-2035 by Jean-Christophe Énée
|
|
--Initiated by Jean-Chrisotphe Énée
|
|
--followed by jean-christoph@atlantic-game.com technical team
|
|
--Web Site = <https://atlantic-game.com>
|
|
|
|
|
|
PosPersonnage = {}
|
|
PosPersonnage.X = 50
|
|
PosPersonnage.Y = 400
|
|
PosPersonnage.Saute = false
|
|
PosPersonnage.tir = PosPersonnage.X + 35
|
|
PosPersonnage.tirY = PosPersonnage.Y
|
|
|
|
tir = false
|
|
Pistol = PosPersonnage.tir
|
|
function Niveau()
|
|
|
|
PositionVert_1 = 0
|
|
PositionVert_2 = 800
|
|
PositionHoriz = 565
|
|
|
|
for PositionHoriz = 565, 240, -65 do
|
|
love.graphics.line(PositionVert_1, PositionHoriz, PositionVert_2 , PositionHoriz)
|
|
PositionVert_1 = PositionVert_1 + 100
|
|
PositionVert_2 = PositionVert_1 + 300
|
|
end
|
|
love.graphics.rectangle("fill", 700, 220, 20, 20)
|
|
end
|
|
|
|
function Personnage(LaPostition)
|
|
|
|
local x, y = PosPersonnage.X, PosPersonnage.Y
|
|
|
|
-- personnage
|
|
love.graphics.rectangle("fill", x, y, 10, 10)
|
|
love.graphics.line(x + 5, y + 30, x + 5 , y )
|
|
love.graphics.line(x - 10, y + 15, x + 20, y + 15)
|
|
love.graphics.line(x + 5, y + 30, x - 5 , y + 40)
|
|
love.graphics.line(x + 5, y + 30, x + 15, y + 40)
|
|
-- pistolet
|
|
love.graphics.rectangle("fill", x + 20, y + 10, 5, 10)
|
|
love.graphics.rectangle("fill", x + 20, y + 10, 15, 5)
|
|
|
|
end
|
|
|
|
function love.load()
|
|
|
|
end
|
|
|
|
function love.update(dt)
|
|
|
|
if PosPersonnage.Saute == true then
|
|
for j = 0, 30 do
|
|
PosPersonnage.Y = PosPersonnage.Y + 1
|
|
end
|
|
PosPersonnage.Saute = false
|
|
end
|
|
|
|
if love.keyboard.isDown("up") then
|
|
for i = 0, 30 do
|
|
PosPersonnage.Y = PosPersonnage.Y - 1
|
|
end
|
|
PosPersonnage.Saute = true
|
|
end
|
|
|
|
if love.keyboard.isDown("right") and PosPersonnage.X + 35 < love.graphics.getWidth() then
|
|
PosPersonnage.X = PosPersonnage.X + 1
|
|
end
|
|
|
|
if love.keyboard.isDown("left") and PosPersonnage.X - 10 > 0 then
|
|
PosPersonnage.X = PosPersonnage.X - 1
|
|
end
|
|
|
|
if love.keyboard.isDown("space") then
|
|
tir = true
|
|
end
|
|
|
|
if tir == true then
|
|
Pistol = Pistol + 3
|
|
end
|
|
|
|
if Pistol > love.graphics.getWidth() then
|
|
Pistol = PosPersonnage.tir
|
|
PosPersonnage.tirY = PosPersonnage.Y
|
|
tir = false
|
|
end
|
|
end
|
|
|
|
function love.draw()
|
|
|
|
Niveau()
|
|
Personnage(LaPostition)
|
|
|
|
--tir
|
|
if tir == true then
|
|
love.graphics.rectangle("fill", Pistol, PosPersonnage.tirY + 10, 2, 2)
|
|
end
|
|
end
|