Then I got distracted…. Not sure why but I redownloaded Pico-8. My bois1) and I play a lot of duck game and I'm no artist 2) but I since pico 8 uses 8×8 sprites. How hard could making a duck be!
yea not that hard I guess. Hes kinda cute. And he could also hold a gun and move right! 3)
The duck was so cool I had to get it working a little more… So I thouight I could get him moving around and quacking. I mostly copied the code from this website4). After A while I had a little level and a duck moving around!!
wow!5)
The only kinda cool thing I did on my own was get the duck to quack! there is no sfx yet but the way I got em quacking is Kinda clever? idk maybe
I basically have two animations for idle and run. One quacking and one not quacking.
The quacking animations are exactly 16 frames offset from their non quacking counter parts. So all I need to do in code is check if the player is holding the quack button
if btn(🅾️) then plr.quacking = true else plr.quacking = false end
Then in the animation update a variable “quack” equals 0 or 16 based on if the button is played. We then will play the idle/run frame + quack. If the quack button is not held this will be the initial animation otherwise it will add 16 and play the quack animation. This works clean while the player is running or jumping as the duck body keeps its current motion and only the mouth snaps to its place.6)
--quacking local quack=0 if plr.quacking then quack = 16 end
.. and then in the actual animation
--running elseif plr.running then if plr.sp > run_end+quack then plr.sp = run_strt+quack elseif plr.sp < run_strt+quack then plr.sp = run_strt+quack end if time()-plr.anim>0.1 then plr.anim = time() plr.sp+=1 if plr.sp>6+quack then plr.sp=1+quack end end --idle else if plr.sp < idle_strt+quack then plr.sp = idle_strt+quack end if time()-plr.anim>.3 then plr.anim=time() plr.sp+=1 if plr.sp>38+quack then plr.sp=33+quack end end end end
Yeaaa that was bascially my weekish and day. Hope I didn't forget my rust. Oof
btwdubs nglw/btc here is the link to the live cart.. These words right here, please and thank you