From a8b5b9dbe64f137f8e36b48a7462f28e7d0ce1a1 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 21 Jun 2025 16:07:23 -0700 Subject: [PATCH] fast shot rendering prototype it's slow *and* it sucks, and making it not suck will make it much slower. this is bad --- vacuum_gambit.p8 | 65 ++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/vacuum_gambit.p8 b/vacuum_gambit.p8 index 2860a73..03ca400 100644 --- a/vacuum_gambit.p8 +++ b/vacuum_gambit.p8 @@ -838,8 +838,20 @@ function bullet_base:step() if (self.current_step == 0) return "stop" end +warmpal = { + [0]=0,1,2,1,2,1,5,10,2,4,9,3,13,5,8,9 +} + function bullet_base:draw() - spr(self.sprite, self.x, self.y, self.width, self.height) + local s,bx,by,dx,dy,w,h,st = self.sprite,self.x,self.y,self.dx,self.dy,self.width,self.height,self.steps + if st > 1 then + pal(warmpal) + for n=st-1,1,-1 do + spr(s, bx-n*dx, by-n*dy, w, h) + end + pal() + end + spr(s, bx, by, w, h) end function bullet_base:spawn_at(x, y) @@ -903,44 +915,33 @@ end -->8 -- bullets and guns -zap_e = mknew(bullet_base.new{ +zap_p = mknew(bullet_base.new{ --shape - sprite = 9, --index of ammo sprite - width = 1, --in 8x8 blocks - height = 1, + sprite = 8, --index of ammo sprite + width = 0.25, --in 8x8 blocks + height = 0.25, hurt = { -- hurtbox - where this ship can be hit x_off = 0, -- upper left corner y_off = 0, -- relative to sprite width = 2, - height = 8 + height = 2, }, x_off = 1, -- how to position by ship - y_off = 8, - + y_off = 0, + steps=4, damage = 1, hitship = const_fxn(true), - category = enemy_blt_cat, -}) - -zap_p = mknew(zap_e.new{ - sprite = 8, - y_off = 0, category = player_blt_cat, }) -zap_gun_e = mknew(gun_base.new{ - cooldown = 0x0.0020, -- frames between shots - veloc = 4, - munition = zap_e, -}) - -zap_gun_p = mknew(zap_gun_e.new{ +zap_gun_p = mknew(gun_base.new{ icon = 19, - munition = zap_p, - veloc = 8, + cooldown = 0x0.0020, -- frames between shots + veloc = 2, aim = 0.25, + munition = zap_p, hdr = "mAIN gUN", }) @@ -1333,7 +1334,7 @@ chasey = mknew(ship_m.new{ drag = 0.075, init = function(ship) - ship.main_gun=ship.main_gun or zap_gun_e.new{} + --ship.main_gun=ship.main_gun or zap_gun_e.new{} end }) @@ -2031,14 +2032,14 @@ function rearm_mode:update() end __gfx__ -00000000000650000000000000000000bb0b50b59909209200cc0c00000000003b00000082000000e00e8002e00e800200333300002222000000000000000000 -00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb0037000000a2000000e0e8880240e8480403bbbb30028888200000000000000000 -00700700006d6500000000000cddddd00b33335009444420c00c000c0b333330b7000000a8000000e88e2882e48e24823bbaabb3288aa8820000000000000000 -00077000067c665000000000cdd10cd10b3dd350094dd42000c0000cb3350b35b7000000a8000000e88e2882484e24423ba77ab328a77a820000000000000000 -00077000067d665000000000cd10cdd100b3350000944200c0000000b350b335b7000000a8000000e88e2882e84e28823ba77ab328a77a820000000000000000 -0070070065666765000000000ddddd100b33355009444220c000000c03333350b7000000a800000008888820048488203bbaabb3288aa8820000000000000000 -000000006506506500000000001111000b0b5050090920200c0000c00055550037000000a2000000008882000048420003bbbb30028888200000000000000000 -00000000650000650000000000000000000b50000009200000c0cc00000000003b00000082000000000820000008200000333300002222000000000000000000 +00000000000650000000000000000000bb0b50b59909209200cc0c00000000007b00000082000000e00e8002e00e800200333300002222000000000000000000 +00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb00bb000000a2000000e0e8880240e8480403bbbb30028888200000000000000000 +00700700006d6500000000000cddddd00b33335009444420c00c000c0b33333000000000a8000000e88e2882e48e24823bbaabb3288aa8820000000000000000 +00077000067c665000000000cdd10cd10b3dd350094dd42000c0000cb3350b3500000000a8000000e88e2882484e24423ba77ab328a77a820000000000000000 +00077000067d665000000000cd10cdd100b3350000944200c0000000b350b33500000000a8000000e88e2882e84e28823ba77ab328a77a820000000000000000 +0070070065666765000000000ddddd100b33355009444220c000000c0333335000000000a800000008888820048488203bbaabb3288aa8820000000000000000 +000000006506506500000000001111000b0b5050090920200c0000c00055550000000000a2000000008882000048420003bbbb30028888200000000000000000 +00000000650000650000000000000000000b50000009200000c0cc00000000000000000082000000000820000008200000333300002222000000000000000000 0000000000065000000650000003b0000070070080000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000 000000000067500000076500000370000005500080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000 00000000006d6500006d6500000b7000700660079000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000