From 9a26eb4b3af985993c494522711dc8bee30d44f6 Mon Sep 17 00:00:00 2001 From: annabunches Date: Tue, 3 Oct 2023 18:49:40 -0400 Subject: [PATCH] Resize sprites, tighten player hitbox, implement smarter collision. --- src/bullet.lua | 11 ++++++++--- src/images/ebi.png | Bin 651 -> 4303 bytes src/images/ika.png | Bin 761 -> 4514 bytes src/images/kani.png | Bin 4601 -> 4945 bytes src/kani.lua | 5 +++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bullet.lua b/src/bullet.lua index 91bada1..7cfa3ca 100644 --- a/src/bullet.lua +++ b/src/bullet.lua @@ -32,13 +32,18 @@ end function Bullet:update() local collisions = select(3, self:moveWithCollisions(self.x+self.vector.dx, self.y+self.vector.dy)) + local realCollision = false + for i=1, #collisions, 1 do - -- anything the bullet can collide with should be damaged by it + -- anything the bullet can collide with should be damaged by it, but it has to hit an actual pixel local obj = collisions[i].other - obj:damage(self.damage) + if self:alphaCollision(obj) then + obj:damage(self.damage) + realCollision = true + end end - if #collisions >= 1 or self:outOfBounds() then + if realCollision or self:outOfBounds() then self:remove() end end diff --git a/src/images/ebi.png b/src/images/ebi.png index ca4c62c0daf4e4c4b1dad76241ac3e7ff1b70bad..cb0d487e73a4e50d705002fa3361170b6a3973e8 100644 GIT binary patch literal 4303 zcmeHKd2kcg85cDM?E0XFkN}1*>$pSQS?!_KwMZCO61EHiVJpGVCSkSvR^G9sRd?4q zoP>a#Kp|Xdp|lvcK_z-|v0j?|tvh+YSCD<+<52vJD19uD8Nn1>cBvPZ|%OJ<2Q3!q+Daff}`n zO&~E@62ve-)Km;0ASnt4L-O3_W#@Cdken|<8@H?q-@0M@xVXM)%f&^6xB5^OcInQ0 z-G${fPoBXXpZ)bzS@oeF`CHHJnqi%~qhWFRmi^`P8#^+ezS7mR%HMcYt=-qwSUzi3 z^EV6L?jvibw(Y50zR!I1;Jnhi3yxfD`rg{^)fCp(lwT0{ocr{j8(;ZQZa+u8@4S9I zkbQMKw~PlR#WS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0<1N)xqS_ zFKE(`q_{W=t_24_7OM^}&bm6d3WDGVh^vc}qKlOHzogKABG!ZBe!RQ)xO)c(wGva! zjxeBVmXU}?#B^p=^u3}7qZmXN<|Jn7vE*V3ZO7L=Jbb+i@vQde{v3Tu)?|Q3Bn~s( zu!uK^XErUJ^FDEa6(oiDoOr^Z3lcwaU3U46bKYTrX9kQ^VxBlaEaqESZedn1RN`sk zprUG&FQi?6Ryc2QR!bGuxF>(1KdY@IxlVHgQ7j>bI7G;(pokJIglN@BF_EDCNE`pK zy{D6t z+YcWJ2_6?525df#+LHqiCw~CYNklGf(@jzs5DzG%c@y?93oKX`L4foF9`*;?}@5UKRl z#Z(UfC5DUqra#UMb{;mLr^ shQ@3)#n^GNG262r%Z;`j8_o;MHmo!*9C^5v&Hw-a07*qoM6N<$f<}`=t^fc4 diff --git a/src/images/kani.png b/src/images/kani.png index fb3ce138f93e403d1509df9ea23170dcd3ca6ec6..5123cafe072790126d54acb5da7b74ad78b6c545 100644 GIT binary patch delta 1127 zcmV-t1ep8zBhe-$iBL{Q4GJ0x0000DNk~Le0000d0000m2m}BC062N8od5s;?vW)Q ze_3wDAPoHH6g`5s06q>`p41!k_#ME!G?glKBrJPy>|v6wug_Qd=#VPOwo2F^M5bDZYVkq7TzS5PSu91!un-9URQ!g~RvbaL)JLd!cP5 zVOlO7K$=yB;~x5#{*|@zMwbpfcCmu6%m<@WkH+))O3Ua=-*`38{dtz7xD2HWRTkz& z1+9ItJ+E@ZDmHID_gMTOwxTqPf5cDXohXeAn_V|eX5o*gxy@RfU5rd$wT;6W1BO_P znK31yqA$(VIl*R6>QE4HPe~|Eh}D~Grs76a%E{qKW^9Jf`w833sIO zG(!nzL|&(OVY$XfmVwuTwIp84k+4!;09v`~&J zpXqr301q^?Oah7mBxPkXGh;AfG%YbTI590WH#lT1Ib&jCEnzZYGdD3ZGGsSpWRv;? zsthwXGcYhWH#0IdIWv>61#J#7Fgh?ZR53U@G&4FfHj^s`APzAwIxsU-F*r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