not exactly sure how to layout the code, but so far i have these:
in the init_game, level=1
when the level 2/3/4 door is entered, the level is set to 2/3/4
but, im not exactly sure how to make the code work for the checkpoint. how can i fix this??
AND BEFORE I FORGET how can i make the level 4 camera work?
pretty sure the checkpoint code is in the page with the spikes and doors, should be right at the top of the page with the spikes
Tab 6 has a comment that says --checkpoints but nothing is in that tab. That's the only place I can find a reference to checkpoints in the code at all.
my apologies, the "checkpoints" test area wasn't labelled. its in tab 3 at the very top, where the spikes are.
once you have replaced the 'and level=2' by and level==2, you can see that your checkpoint system partially works :
when you run right at start of level 2 into the spikes, you return to the start of level 2, but if you land on the spikes from above, you return to level 1.
that's because you wrote
if collide_from_above or collide_from_below or collide_from_right or collide_from left and level==2 then
what you meant is
if (collide_from_above or collide_from_below or collide_from_right or collide_from left) and level==2 then
where any collision and level==2 id your condition
without parenthesis, it means
if collide_from_above or collide_from_below or collide_from_right or (collide_from_left and level==2) then
c1 or c2 and c3
means
c1 or (c2 and c3)
When in doubt, use extra parenthesis.
About the cam4 problem, I put an assert(false) at start of level4cam, so I know the function is never called.
In update_game, you test the X and Y coordinates of the player to determine the camera to use...
1st, abs is absolute value, and your coordinates are positive so it doesn't do anything, and 2nd, you have a level variable, so
if level==1 then
level1cam()
elseif level==2 then
level2cam()
elseif level==3 then
level3cam()
elseif level==4 then
level4cam()
end
is much simpler.
in lelev4cam, you'll have to adjust the camera so it stays in the level. I'm not sure where level 4 is in the map so you'll have to do it yourself.
(it's a good idea to assert the player coordinates are in the expected level.)
Remarks : doors only work when going right, probably another parenthesis issue in player/door collision code.
Spikes don't work in level 3 and more.
You can jump out of L3.
thanks so much for the help realshadowcaster. you're a lifesaver, appreciate it so much
No problem, I got top notch help from the community when I started pico-8, and am glad to pay forward when problems are clearly stated.
When I saw your post 4 days ago, I saw the code was not running and your question was not about a syntax error problem, so I didn't respond and just assumed you uploaded the wrong file.
Because Soupster, merwok and 2bitchunk worked on it, the problem was clarified enough so I could help. It's the continuation of their work, not just mine.
Remember to change the post status to resolved, once you have no more question about the checkpoints or cam4.
[Please log in to post a comment]