Log In  

About Me

Hi, my name is Evmank2k, and I am just learning how to make games in Pico-8. I am young (not allowed to share age) and would appreciate any help from expert game makers on how I can make my game better.

Pixel Parkour

Pixel Parkour is my attempt at making a new type of game, where the character is just one pixel, and all the hazards are identified by colors. I like these types of games, as they are quick to play, and allow me to use my imagination to interpret what the colors mean. I have discussed with my Dad, and we both agree that everyone who plays these may see the colors as different to them. For example, for me orange may mean lava, but for someone else, it may mean fire.

How to Play

Simple, you are the peach pixel. Use left and right arrows to move the character left or right. Down arrow digs (if the block can be dug). Up arrow makes your character climb.

Feedback

Please leave your feedback on how I can improve the game. All comments welcome.

Enjoy!

Evman2k

Cart #pixelparkour_cod3-1 | 2020-05-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

P#76566 2020-05-14 15:48 ( Edited 2022-01-14 02:54)

It does play incorrectly in the browser. Not my fault. Does anyone know how to fix that?

Edit
Maybe I should have used "btn()" in that cartridge.

Edit number 2
Instead of "btnp()."

Edit number 3
BTN() doesn't work.
Was just updated.

P#76568 2020-05-14 15:52 ( Edited 2020-05-14 16:04)
2

Hi Evman2k.

Just glancing at the code, looking for where btn() or btnp() could be going wrong for you, here are a couple of thoughts:

Guide order of evaluation with brackets

With the conditions of if statements, it is possible to put brackets around conditions to make them be evaluated together. Then whatever their result is can be evaluated with other conditions outside of the brackets.

So:

if (a and (b or c or d)) then
 --code here
end

... would mean that if any of b or c or d is true, and a is also true, then the condition will evaluate to true.

I think that might be useful with these lines:

if btnp(⬅️) and sget(px-1,py) == 0 or btnp(⬅️) and sget(px-1,py+64) == 15 or btnp(⬅️) and sget(px-1,py+64) == 7 then
 px-=1
end
if btnp(➡️) and sget(px+1,py) == 0 or btnp(➡️) and sget(px+1,py+64) == 15 or btnp(➡️) and sget(px+1,py+64) == 7 then
 px+=1
end

... which I think you could rewrite as:

if (btnp(⬅️) and (sget(px-1,py) == 0 or sget(px-1,py+64) == 15 or sget(px-1,py+64) == 7)) then
 px-=1
end
if (btnp(➡️) and (sget(px+1,py) == 0 or sget(px+1,py+64) == 15 or sget(px+1,py+64) == 7)) then
 px+=1
end

Values for btn() should be the same within one frame

Also, not far after that you have these while loops:

while sget(px+1,py) != 0 and btn(⬆️) and sget(px,py-1) == 0 do
 py-=1
end
while sget(px-1,py) != 0 and btn(⬆️) and sget(px,py-1) == 0 do
 py-=1
end

I believe that within a single frame, pico-8 will have an unchanging value for btn(⬆️); next frame it might be different, sure. But as it's not going to change within a single frame, you might as well check it before the while loops:

if btn(⬆️) then
 --while loops here
end

The game loop can do loop work in place of a while (etc)

(... unless you want the whole loop to be evaluated within one frame.)

In fact, here, perhaps you don't even need the while loops - they're inside _update() already, right? Update itself is called as part of the main game loop. So whatever code is in them will get a chance to happen next frame as well; so perhaps this would work:

if btn(⬆️) then
 if sget(px+1,py) != 0 and sget(px,py-1) == 0 then
  py-=1
 end
 if sget(px-1,py) != 0 and sget(px,py-1) == 0 then
  py-=1
 end
end

It could even be made more concise than that; I think this will work the same:

if (btn(⬆️) and sget(px,py-1) == 0) then
 if (sget(px+1,py) != 0 or sget(px-1,py) != 0) then
  py-=1
 end
end

This should make climbing happen over a number of frames rather than in a single frame, if I have understood your code correctly.

Indents help

Also, it can be useful to indent code blocks like I have above - it helps the eye track what's going on while you're reading code. I use a single space indentation for pico-8 because of the small character width of the screen; in code outside of pico-8 I might use more than a single space.

(Disclaimer)

Please note: I haven't tested the above code changes. If you want to try them, make a backup of your file first, then try commenting out or deleting the lines you already have and try the rewrites instead. (Make backups when you feel you need to.)

I have only made a few small suggestions here. There is probably more that could be said, but hopefully these comments are enough for now. :)

I wrote these comments thinking you hadn't tracked down the problem you were having with btn(), but I think I misread what you had written and you have in fact tracked it down. So, well done! All the same I hope my comments above are of some use to you.

Playing the game

I would have liked to comment on the gameplay, but I didn't get far through it - I found it a little tricky. Perhaps someone else will have useful comments about it.

P#76591 2020-05-14 21:39 ( Edited 2020-05-15 06:45)

Code help

Hello remcode.
I have tested your code, and most of it works, thank you very much.

This code you shared below, is much shorter than my original code. This worked perfectly for me.

if (btnp(⬅️) and (sget(px-1,py) == 0 or sget(px-1,py+64) == 15 or sget(px-1,py+64) == 7)) then
 px-=1
end
if (btnp(➡️) and (sget(px+1,py) == 0 or sget(px+1,py+64) == 15 or sget(px+1,py+64) == 7)) then
 px+=1
end

The following two code suggestions didn't work for me in my game.

if btn(⬆️) then
 if sget(px+1,py) != 0 and sget(px,py-1) == 0 then
  py-=1
 end
 if sget(px-1,py) != 0 and sget(px,py-1) == 0 then
  py-=1
 end
end

and

if (btn(⬆️) and sget(px,py-1) == 0) then
 if (sget(px+1,py) != 0 or sget(px-1,py) != 0) then
  py-=1
 end
end

When I used, the results were that the cube floats in air. Also, pressing the up arrow will cause the cube to sometimes clip through solid ground.

I tried fixing it, but my computer crashed before I could fix. :-(

Indenting

I could of indented, but I have so many ideas I worry about running out of space. My Dad says I should try to setup an external IDE to edit my games in, instead of using the built-in editor. What do you use?

Playing the game

The game took me a while too! If you want help. I know a little on speedrunning and how to beat the game.

  • Holding the up arrow at all times gets you through most of the game.
  • Get the cubes from bottom to top to get the fastest record.
  • Press "X" in the intro of the game to get the fastest record.

New stuff I am planning

  • New secret ending!
  • Clone AI will be remade
  • Patching the clone clipping bug
  • Built-in map editor

New ideas or bugs

If you find any bugs or have any ideas. Please leave them in the comment section.

-- Evman2k

P#76636 2020-05-15 18:20

Hi evman2k.

Thanks for the play tips.

IDE

For an external IDE for Pico-8 I use Notepad++

An internet search should turn up its home page, but here is a link to it anyway:

https://notepad-plus-plus.org/

It runs on the Windows OS.

P#76680 2020-05-15 23:43

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 07:53:52 | 0.014s | Q:17