From 61f0ba6a09530bec7f9b18f6bbb46c0413ae569b Mon Sep 17 00:00:00 2001 From: Heitai-C11 Date: Sat, 26 Mar 2022 18:49:26 +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.swp | Bin 0 -> 16384 bytes main.lua | 84 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 .main.lua.swp diff --git a/.main.lua.swp b/.main.lua.swp new file mode 100644 index 0000000000000000000000000000000000000000..3e4fdd97874466b0c996ddc6638611e41f789f73 GIT binary patch literal 16384 zcmeI2UyK{Y9mfX~b#Gz$L;ogV*uaO<;uITW?I5V%5{kSZskhC7lF_UyI2u->)S zYc2^*K%o-hp?@CApFXre_#*{TRH-k3P#ZOEfdHZ}^dXU<Lw*nl|b~RS0}$z5cW7 zvvWZ}(lEaJcz1SwGryVd%+Ahl@1`^BR((${OXmciMM4~%xNiEuf=O}Cc|y#T?Z7f- zJg2BKdw=p?!FEeVEiePyb9>uuZ&x_H)-Rc^T?lGBojg72=s}N|&PJ<%#?#sSjEKt$VVA-;DqN_7x!x!P9UrTn`t( z`LF~&{IU@5!ajH&cEAQ$4{Kp5jKCGJ2>!QFh=0I)@HX5JSvYvE5I=%%!TaY3@d(@q zM`({~(;Kh{ehrVqPvJhO!W}RHD0uV)GIB9@lSXY{se!7$6zN+!CFYe zRd6M|b|!Vh!|)JHz~yiWd<~Aw6XG2>0Q+Gt?1o+N82E4pTnCF`AuNFTaD*2)|AvF` z2Y3Ru!X{V(^I;D!fqnzKVHZ3A+hHkWpiVuOTM$x8$Gh7~^FJHavYoG`eJdZBZppDy z14Y|$28QH>T?;&iqgR`-{F>*wX30tiwm&7Wk=e|U%<(&@YBCJ2s*|=|YK=*`z*hfF z652#gF>0SB6Mfp`*se7&+X*4>t~UNv#!daB+SnH4=>l9XdIJ0vgbFp>pNnW%hK zsM8?IYE-X!NoI~e{uk?RUP;>+#DZ_mqy}39+ZK41p&Lt#=Ty|X#%NQ0SDDCwAttwI zM%p4qRAfbBCY7w9$ z3&cn!n!k+g>|<50&SjvQ&1+4*<8Pl@vINEWs0QBI-N1MsBbTwsn7Hfe)q)vVsX`Fl zd5LVtGYid|QsDL&YmnSb6LW~RC0bpxqeD`ThO64~7L^puW}>B8R>RxO3c4GiR-2Ua zs|qN;BluToc@qS&S!EAGh- zML*kyPK`93>ip2b%%}8|ZAtX`*Vr1S=5X~op1?NFRh1K|v!;2S+0)qa zg}X%7n|p{PV#|_L7q_)9uCx4LQ*O44+4#jqO7z+8b#C;OgZApx*!)vN{OVM<6}NuU zYLe&4XhtS%3;T5&>YgfNU-t!a4+{{T;8mY0K|TKnek zuo*a}8`ycHWLB(n-m9#@u;@9CH)9p#^cH!iWx7Vb?5oFSwY;*+UItda?Aq#S5Ljk~ z(yLq^80-bY;;U8haaG(4s%1;=ebC*z+rnzx8eg?$jU4x?Tf)tpOpOon#Lwl7T!#G{ zp4&y0=T=e5GQ2gl-Or`7Qtdhl6wHnonQM()R;c*@c0%7J#CIzGFL6+x=ZWz*z}fHu z@p};#!|#dNt8gj2LCn4tQt%gI_8&qH4iSI<7?#5_xE4lXF{t?bAaVBZ;J5HA_yODm zi(o(T_EYc>+y-BVOW`6=vG_bV13n_YJ__%_yYP2-8J>nZ+y$%P2DlzBhI#NdarW!* zEIbLj;6}I*-Y3R>3toj+UT&T z7aWEIupeH5=iot@hVQ^p#^5kK13!nKz)q+@0WN}YoEk&)8Gc6rSA6ewazy!t(X&-* z!>8l?k literal 0 HcmV?d00001 diff --git a/main.lua b/main.lua index 26e4989..3a731cd 100644 --- a/main.lua +++ b/main.lua @@ -8,7 +8,7 @@ PosPersonnage = {} PosPersonnage.X = 50 -PosPersonnage.Y = 400 +PosPersonnage.Y = 515 PosPersonnage.Saute = false PosPersonnage.tir = PosPersonnage.X + 50 PosPersonnage.tirY = PosPersonnage.Y @@ -21,30 +21,41 @@ 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 +local level = { + {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, + +} function Personnage(LaPostition) - local x, y = PosPersonnage.X, PosPersonnage.Y - 45 + local x, y = PosPersonnage.X, PosPersonnage.Y --print( Position.Horiz[3] ) -- personnage @@ -65,15 +76,16 @@ end function love.update(dt) + if PosPersonnage.Saute == true then - for j = 0, 30 do - PosPersonnage.Y = PosPersonnage.Y + 1 + for j = 0, 80 do + PosPersonnage.Y = PosPersonnage.Y + 1 end PosPersonnage.Saute = false end if love.keyboard.isDown("up") then - for i = 0, 30 do + for i = 0, 80 do PosPersonnage.Y = PosPersonnage.Y - 1 end PosPersonnage.Saute = true @@ -81,33 +93,45 @@ function love.update(dt) if love.keyboard.isDown("right") and PosPersonnage.X + 35 < love.graphics.getWidth() then PosPersonnage.X = PosPersonnage.X + 1 + PosPersonnage.tir = PosPersonnage.tir + 1 + Pistol = Pistol + 1 end if love.keyboard.isDown("left") and PosPersonnage.X - 10 > 0 then PosPersonnage.X = PosPersonnage.X - 1 + PosPersonnage.tir = PosPersonnage.tir - 1 + Pistol = Pistol - 1 end if love.keyboard.isDown("space") then tir = true + PosPersonnage.tirY = PosPersonnage.Y end if tir == true then - PosPersonnage.tirY = PosPersonnage.Y Pistol = Pistol + 3 end if Pistol > love.graphics.getWidth() then - PosPersonnage.tirY = PosPersonnage.Y - Pistol = PosPersonnage.tirY tir = false + Pistol = PosPersonnage.tir end end function love.draw() - Niveau() + local size = 20 + for line = 1, #level do + for row = 1, #level[line] do + local cell = level[line][row] + if cell ~= 0 then + love.graphics.rectangle("fill",row*size,line*size,size,size) + else + --love.graphics.rectangle("line",row*size,line*size,size,size) + end + end + end Personnage(LaPostition) - --tir love.graphics.rectangle("fill", Pistol, PosPersonnage.tirY + 10, 2, 2) end