From 8cd8aa1e77262ed661753b95e99958d1383c51dd Mon Sep 17 00:00:00 2001 From: Heitai-C11 Date: Tue, 15 Mar 2022 19:41:03 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20main.lua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/main.lua b/main.lua index d4e3183..26e4989 100644 --- a/main.lua +++ b/main.lua @@ -10,35 +10,49 @@ PosPersonnage = {} PosPersonnage.X = 50 PosPersonnage.Y = 400 PosPersonnage.Saute = false -PosPersonnage.tir = PosPersonnage.X + 35 +PosPersonnage.tir = PosPersonnage.X + 50 PosPersonnage.tirY = PosPersonnage.Y tir = false Pistol = PosPersonnage.tir + +Position = {} +Position.Vert_1 = {} +Position.Vert_2 = {} +Position.Horiz = {} + + function Niveau() - + + local i = 0 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 + + Position.Vert_1[i] = PositionVert_1 + Position.Vert_2[i] = PositionVert_2 + Position.Horiz[i] = PositionHoriz + i = i + 1 end love.graphics.rectangle("fill", 700, 220, 20, 20) end function Personnage(LaPostition) - local x, y = PosPersonnage.X, PosPersonnage.Y + local x, y = PosPersonnage.X, PosPersonnage.Y - 45 + --print( Position.Horiz[3] ) -- personnage love.graphics.rectangle("fill", x, y, 10, 10) - love.graphics.line(x + 5, y + 30, x + 5 , y ) + 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) + 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) @@ -78,12 +92,13 @@ function love.update(dt) end if tir == true then + PosPersonnage.tirY = PosPersonnage.Y Pistol = Pistol + 3 end if Pistol > love.graphics.getWidth() then - Pistol = PosPersonnage.tir PosPersonnage.tirY = PosPersonnage.Y + Pistol = PosPersonnage.tirY tir = false end end @@ -94,7 +109,5 @@ function love.draw() Personnage(LaPostition) --tir - if tir == true then love.graphics.rectangle("fill", Pistol, PosPersonnage.tirY + 10, 2, 2) - end end