[satisfied with workaround] 4.5.2 & 4.5.6 Collision issues

octopusman

Member
Even if I put entire null tiles between the solids and the stop moving tiles.
Fixes the issue where it doesn't reverse direction at the correct moment when moving right.
https://vimeo.com/451361842

However, it still clips through the floor when hitting the stop moving right tile (03) and then moving up.
 

octopusman

Member
ok it's not center because I forgot I shaved a couple of pixels off the bounding box but making bounding box full is same effects.
 

octopusman

Member
Here's a video with a full bounding box:
https://vimeo.com/451363193

02 stops it correctly but causes moving right to see solid too late.
03 doesn't stop it correctly and doesn't cause moving left to see solid too late.
 

octopusman

Member
What's also curious is that you can see that the player is a pixel or two below where the starting position shows he should be...
I just noticed that all of the tutorials got removed.
So I'm just going to switch to 4.5.6 and start over. cross your fingers.
 

octopusman

Member
I installed the new version and spent the rest of the night re-importing my custom scripts, commenting out error throwing code, re-naming labels, and setting inputs.
Going to set up the player after work and see what happens. If it breaks, I will make a new thread with the new NesMaker version in the title. Thanks for helping!
 

octopusman

Member
Turns out that it is even more broken in 4.5.6.
I'm going to take a deep breath and just do some tutorials.
Hopefully there's some eureka moment.
Part of my player sprite is being drawn in the HUD area in 4.5.6. too (used the Adventure Module) an need to figure out what that's all about too.
Wasted 30 minutes trying to figure out why my player wasn't moving in action step 2 but remembered the do physics doesnt move in that step for adventure. Hard to member all the details so there may be more things I'm not privy to that are messing things up.

Is there just a blank module that "works" and doesn't have the intricacies that are specific to a genre-focused module?
 

octopusman

Member
Good news is that I think I had a revelation and will update the post once I can articulate it well. I think it will help a lot of folks messing with custom tiles.
 

octopusman

Member
Misconceptions:
Tiles: I was under the assumption that tiles worked differently than they do.
Basically, when checking solids, the game compares the bounding box of the object (player in this case) to the edge of the solid.
When a tile, such as the warp tile check the player, it's not until the player is completely inside of the tile that the check occurs which, in the warp tile's case, would trigger the code to warp the player.
[Edit] So I was wrong about this... again 2 posts down explaining phenomenon.
So, I had a tile that was supposed to stop the player from moving and I expected it two stop the player the moment that it would be collided with, similar to a solid tile. However, it acts more like the warp tile.
Bounding Boxes:
I was thinking that as long as the player could fit between tiles, it would. I set solid reaction to stop and put a solid tile on the x row one y value above the player (so.... diagonally). When about the move under the solid, the player would stop when its bounding box was a full tile (16x16). Okay.

Hopefully, that makes sense.
 

octopusman

Member
Alright. It's still kind of still broken the same way...
Clearly, it's the way that the engine checks collisions. No solution yet.
 

octopusman

Member
So I was wrong about the warp. Looks like you warp as the bounding box touches it.
So my stop moving left and right tiles are causing the adjacent tiles to not do what they're supposed to do (stop the player or change direction).
 

octopusman

Member
Alright. Final conclusion is. If you have a tile that is checking action step, it will totally ignore collision of adjacent tiles.

Video:
https://vimeo.com/451714013

Image of collision and tiles:
https://imgur.com/2dnWG7R

My custom solid tile:
Code:
;;solid tile
CPX player1_object
BNE +notPlayer

LDA ObjectUpdateByte
ORA #%00000001
STA ObjectUpdateByte ;; makes solid

TXA
STA temp
ChangeActionStep temp, #$00

+notPlayer
rts

Custom reverse vertical tile:
Code:
	CPX player1_object
	BNE +skipThis

	TXA
	STA temp
	GetActionStep temp
	CMP #$01
	BNE +wasNotUpLeft
	TXA
	STA temp
	StartMoving temp, #DOWN
	TXA
	STA temp ;; assumes the object we want to move is in x.
	ChangeFacingDirection temp, #FACE_DOWN
	RTS
	+wasNotUpLeft
	TXA
	STA temp
	GetActionStep temp
	CMP #$02
	BNE +wasNotUpRight
	TXA
	STA temp
	StartMoving temp, #DOWN
	TXA
	STA temp ;; assumes the object we want to move is in x.
	ChangeFacingDirection temp, #FACE_DOWN
	RTS
	+wasNotUpRight
+skipThis

Custom reverse horizontal:
Code:
	CPX player1_object
	BNE +skipThis
	TXA
	STA temp
	GetActionStep temp
	CMP #$05
	BNE +wasNotLeft
	TXA
	STA temp
	StartMoving temp, #RIGHT
	TXA
	STA temp ;; assumes the object we want to move is in x.
	ChangeFacingDirection temp, #FACE_RIGHT
	RTS
	+wasNotLeft
	TXA
	STA temp
	GetActionStep temp
	CMP #$06
	BNE +wasNotRight
	TXA
	STA temp
	StartMoving temp, #LEFT
	TXA
	STA temp ;; assumes the object we want to move is in x.
	ChangeFacingDirection temp, #FACE_LEFT
	RTS
	+wasNotRight
+skipThis

I made my own reverse and solid because I was starting to not trust the reverse direction or stop on solid object details though those are probably fine.

In the video you can see that. Left seems to work fine because the reverse tile has a complete tile of space between it.
When moving right, you can see that it clips mostly through the reverse tile before reversing.
This is the same issue which causes the player to clip through the solid when moving DOWN after having direction reversed after moving UP.
I also tried this with the stock solid time and same thing.

So I will probably have to change my game design to account for this unless there is a revelation in tutorials which... I'm going to watch and do all of them before proceeding with my own game since I feel like I will encounter issues like this and they will just help me all-around, in general.
Thanks for bearing with me.
 

octopusman

Member
Solution that I'm happy with!

So I got rid of tiles that check the player action.
Instead, I told the moving left action to do the moveLeft for timer of 1
same thing for right
At a speed of 33 and one tile between the player and the reverse direction collision, it looks just about right (returning to starting position).
I also don't clip through the floor anymore!

https://imgur.com/P6oHAWL

https://vimeo.com/452356562

If you have questions, please reach out to me. I haven't gotten in the habit of checking the discord.
 

octopusman

Member
I could see how myself or someone else could still have issues trying to accomplish similar things in scenarios where timers won't cut the mustard but this works for me for now and I'm thrilled that I won't have to change my design.
 
Top Bottom