Follow
8bit_gnosis
PICO-8 0.2.6
by zep
[ :: Read More :: ]

Cart #blocks-0 | 2024-01-25 | Code ▽ | No License

# My second progress update:

I'm trying to implement the ability for my player character to create temporary blocks which can be used as platforms to reach otherwise unreachable areas. The idea is that the bunny player character digs up earth which piles up behind him and then disappears after a few seconds.

1. When the player presses the o button while on a ground tile, a 'newblock' is added to a table so that it can be deleted after its set duration. In order to ensure the original map tile is restored after the 'dirt block' disappears, mget is used to grab the original tile sprite as 'oldblock.'

`if btnp(🅾️) and p.landed then newblock={} newblock.spr=14 newblock.x=p.x newblock.y=p.y newblock.age=0 oldblock = mget(flr(p.x/8)-1,flr(p.y/8)) add(blocks,newblock)`

1. The block is drawn according to the coordinates stored in a table. The block is drawn behind the player based on whether the character sprite is flipped.

`function draw_block() for myblock in all(blocks) do if p.flp then mset((myblock.x/8)+2,(myblock.y/8),myblock.spr) else mset((myblock.x/8)-1,(myblock.y/8),myblock.spr) end end end`

1. The block is deleted from the table after it's aged past its duration and mset replaces the block with the original 'oldblock' variable.

`function update_block() for myblock in all(blocks) do myblock.age+=.1 if myblock.age>10 then del(blocks,myblock) mset((myblock.x/8)-1,(myblock.y/8),oldblock) end end end`

## Problems

There are multiple problems I'm encountering.

1. The dirt block doesn't always draw directly behind the player sprite but sometimes 2 tiles away.

2. Two blocks are drawn if the player happens to move in the opposite direction immediately after the first block is drawn.

3. The original map tile is not always stored and replaced. Frequently, the 'oldblock' variable will store the adjacent tile sprite instead.

4. If the button is held down, multiple dirt blocks are drawn and only the final one appears to delete.

## Gratitude

If anyone has any insight into how to fix these problems, even it is simply nudging me in the right direction or pointing to a resource, you have my eternal gratitude. I'm still a complete novice at this. Thank you.

P#140599 2024-01-25 16:28 ( Edited 2024-01-25 16:53)

 1
[ :: Read More :: ]

Cart #fsatobugu-1 | 2024-01-09 | Code ▽ | License: CC4-BY-NC-SA
1

This is my first blog update. I'm feeling a bit defeated. I'm not making meaningful progress any more. The progress I have made is all but entirely owed to tutorials from nerdy teachers and lazy devs. I'm now spending way more of my time trying to find relevant content to learn from than I am actually learning. I've spent hours combing through BBS posts, reddit, youtube, and discord. When I do find discussion that seems relevant to what I want do, it's rare that I am able to parse the code to learn from it. Trying to stay motivated and move forward.

What I have thus far:
-A running, jumping player sprite which I don't understand how to further animate without continuously looping through a cycle of sprites (How do I do a once-and-done animation?)
-A functional camera that follows the player
-Collision detection for the map tiles
-An expanding and contracting field of view effect which I have no idea how to adjust due to the math involved.
-A particle effect simulating kicked-up dirt whose location I'm not fully able to anchor behind the sprite when it's flipped.

What I would like to have:
-Some sort of animated background, perhaps glistening or dripping rocks.
-Breakable tiles for a digging mechanic.

P#139921 2024-01-09 23:11 ( Edited 2024-01-09 23:20)

[ :: Read More :: ]

My first post. I'm beginning this blog to document my progress in pursuing a passion project, the creation of my first game. The existence of Pico-8 and 'mini metroid-vanias' such as Metroid Crimson, The Ascent, and Subsurface have inspired me. I grew up with an NES and my finest childhood memories involved exploring the game worlds of Zelda and Metroid. My goal is to create a game with a focus on exploration and environmental puzzle solving with progression through an ability-gated game world. I lack programming experience and have a general aversion to math. I'm hopeful the community here will share its wisdom if I'm earnest in my attempt to understand conceptually all the code and math and I refrain from making a million requests for information.

My progress so far: With the assistance of a set of super helpful youtube tutorials, I've created a player sprite capable of running and jumping using platformer controls. I've also managed to alter existing camera code to track the player character room by room.

My current obstacle: Collision detection is proving to be a struggle. My player sprite is capable of landing on tiles of empty space. The code uses a combination of local variables and 'objects.' Conceptually I don't understand 'objects' and what the code is doing. Perhaps I need to turn my focus toward learning how Lua works.

P#139373 2023-12-29 19:28 ( Edited 2023-12-29 19:29)