hello everyone, I'm Osis, and I'm new to Pico 8 as well as coding, but when I found some pixel art of some Risk of Rain characters with the Pico 8 palette and most of them being 8 x 8 (a link to their work https://www.reddit.com/r/pico8/comments/mw40ui/risk_of_rain_1_characters_in_pico8_style/ ) I thought that it might be fun to try and make a game, which I have done most of it, the problem is I have a set of animations that should be playing when the player shoots, which at one point worked, however, it now no longer does I have tried going over it many times and still can't find what might be wrong
controls:
Jet pack is Up
Place Turret Is Down
Left Is left
Right Is Right
Z Is Shoot
any help with this problem or anything else you can spot in my code would be very helpful,
here is the problem code:
--
if shooting2 == true and mag >= 1 then
s_timer+=1 --shooting timer
if d == 2.8 and pushing == 0 then
if (s_timer < 4) plr.s=5 spr(6,plr.x+8,plr.y) -- this is here as one spr is more the 8x8
if (s_timer > 6) plr.s=7
if (s_timer > 8) plr.s=8
if (s_timer > 10) plr.s=1 s_timer=0 shooting2=false mag-=1
end
--
note there is this same code copied a few times but just looking for if the player is facing a different way
but even if it was just this bit it should still work I believe.
and here's the cart in full:
So, I found a way to fix the issue from experimenting, but I'm not sure what's going on with your code structure. The issue is that the code you're looking at isn't running at all. The end
right before that is ending the shot()
function. However, pico-8 complains about shot()
not being finished if it's just removed, and I'm not sure what block of code is requiring the extra end
command. The bug seems to be in the big set of compacted if
statements within that function, but your syntax looks correct to me.
Anyway, if you just want a quick fix, move the end
right before the problem code you were looking at down to the spot where the shot()
function is supposed to end.
thanks for the find kimiyoribaka, it also works on my end the only problem is the animation still does not play however when I added a print for s_timer it only counts when the end has been moved so I'm not sure why the animation does not play as if the s_timer is counting up it should play, do you have any clue why that might be?
Found it. Your ani()
function is setting plr.s
, which overrides whatever value that had during the update. The quick solution would be having the ani()
function check s_timer
before doing anything.
The game is quite lovely but admittedly it is a bit buggy.
tunnel rush
[Please log in to post a comment]