Jump to content
IGNORED

Question about Collision Prevention


Recommended Posts

I've got a question for @Random Terrain or anyone else who has played around with the Collision Prevention sample code.

 

I'm having a hard time wrapping my head around the logic behind it.  It works great with an 8x8 sprite, but I was attempting to make it work with a much smaller sprite (a 2x3 block) and I can't seem to figure out how to update the math in the sample program to accommodate the smaller sprite.  I was looking for 2x3 specifically as I'm working on a project that uses a ball sprite of that size, and what I really want is the "sticky wall" prevention. 

 

Any help with figuring this out would be much appreciated. :)  I'm attaching the sample code that I've been using to test.

sample.bas sample.bas.bin

  • Like 2
Link to comment
Share on other sites

The dryer guy looked at the dryer and came back less than an hour later with the part and fixed it. I thought I'd have to wait many days.

 

Anyway, my brain seems to be working good enough to look at the program. I'll compare it to a program I've been working on and see if I've made any improvements to the collision code.

 

 

Link to comment
Share on other sites

Glad to hear your dryer was fixed quickly!

 

I spent an hour or so making mostly random guesses on modifications to make the smaller sprite work correctly with the sliding around walls effect, and nothing seemed to work as I expected.  I was hoping you or someone could clarify a bit on what each of those lines of code is really doing, I wasn't able to follow it very well.  It would be great if you could figure out how to make it work with a smaller sprite, but don't spend forever on it on my account. :)

  • Like 1
Link to comment
Share on other sites

I used pfpixel and hours of playing with the numbers and it finally seems to be working correctly:

 

Here's the .bas file code:

c_test_2024y_08m_15d_1623t.bas

 

Here's the .bin file to use with your favorite emulator:

c_test_2024y_08m_15d_1623t.bin

 

Rub the sprite along the walls as roughly as you can to see if I messed anything up. I removed a bit of code from the up and down sections since the sprite is so small and didn't seem to be necessary, but that could have introduced more problems. We won't know until you get wild with the wall rubbing to see if there is a problem. 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...