Changes to formatting and moving Minecart into Sprites/Objects to get a second look at all the work done so far and recommendations to improve the system. Particularly with regards to "dummy carts" which exist at transition points in dungeons. Potential expansions could be making the minecart a follower when the player is riding it, but this would require more extensive research and probably a separately filed issue. Most of the dummy cart code is handled inside of the Sprite_Minecart_Prep fn.
The collision detection also needs some looking at. There is an experimental routine SetTileLookupPosBasedOnDirection which is meant to help prevent the cart going off the tracks when it hits the custom collision tiles for the corner pieces depending on the direction the cart is approaching them from. This routine would be used inside of the HandleTileDirections routine, so be sure to check that out while reviewing. One potential fix I attempted was the ClampSpritePositionToGrid fn which would clamp the sprite to a 16x16 grid, however this slowed the game down when ran every frame. I attempted to only run it at the corner tracks and this makes a bit of a grinding turn effect, which slows down the ride until the turn has been completed.
Additionally, the cart now requires the player to press the B button when standing near the cart to start the ride. This will show the player swinging their sword, so if there is another button you think would be better like L/R feel free to give that input. This was so the cart was easier to lift with the A button. I also need to handle the logic for the cart throwing and landing, since right now it does not have any distance to the throw and simply drops in front of Link.
Changes to formatting and moving Minecart into Sprites/Objects to get a second look at all the work done so far and recommendations to improve the system. Particularly with regards to "dummy carts" which exist at transition points in dungeons. Potential expansions could be making the minecart a follower when the player is riding it, but this would require more extensive research and probably a separately filed issue. Most of the dummy cart code is handled inside of the
Sprite_Minecart_Prep
fn.The collision detection also needs some looking at. There is an experimental routine
SetTileLookupPosBasedOnDirection
which is meant to help prevent the cart going off the tracks when it hits the custom collision tiles for the corner pieces depending on the direction the cart is approaching them from. This routine would be used inside of theHandleTileDirections
routine, so be sure to check that out while reviewing. One potential fix I attempted was theClampSpritePositionToGrid
fn which would clamp the sprite to a 16x16 grid, however this slowed the game down when ran every frame. I attempted to only run it at the corner tracks and this makes a bit of a grinding turn effect, which slows down the ride until the turn has been completed.Additionally, the cart now requires the player to press the B button when standing near the cart to start the ride. This will show the player swinging their sword, so if there is another button you think would be better like L/R feel free to give that input. This was so the cart was easier to lift with the A button. I also need to handle the logic for the cart throwing and landing, since right now it does not have any distance to the throw and simply drops in front of Link.