• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

I can't get collision working on DND

Mr.Fox

Member
I have watched alot of DND collision turtorials but it still doesn't, work i can still walk trough objects and get no collisions. Can sombody please help me?
 

TsukaYuriko

☄️
Forum Staff
Moderator
That's an empty collision event. This will not do anything by itself unless whatever you're colliding with is marked as solid (which I don't recommend for a myriad of reasons).
 

TsukaYuriko

☄️
Forum Staff
Moderator
I generally recommend programming collisions and any interactions that happen as a result of them manually to have full control over what happens when you collide, not touching solidity. That's a black box that takes control away from you.

You may also want to take a different approach than the one solidity uses, which is resetting a colliding instance's position to its previous coordinates if it is involved in a Collision event with a solid instance. A better approach would be to not allow moving into anything you consider "solid" (but is not actually marked as solid) in the first place.
 

TheouAegis

Member
Even with solids, don't you still need at least a comment in the collision event for it to register? Nut I agree, that's a horrible method unless you are moving 1 pixel at a time.
 

Mr.Fox

Member
I generally recommend programming collisions and any interactions that happen as a result of them manually to have full control over what happens when you collide, not touching solidity. That's a black box that takes control away from you.

You may also want to take a different approach than the one solidity uses, which is resetting a colliding instance's position to its previous coordinates if it is involved in a Collision event with a solid instance. A better approach would be to not allow moving into anything you consider "solid" (but is not actually marked as solid) in the first place.
Can you maybe help me explain what it does and how to do it?
 

TsukaYuriko

☄️
Forum Staff
Moderator
The part of my post that you quoted is also EXACTLY what I suggested NOT to do. I can't check what the linked video is about because YouTube's video servers seem to be down as of writing, so this may or may not be what it's actually about.

Can you maybe help me explain what it does and how to do it?
It makes it so you don't move into instances you don't want to move into.
You do it by - before applying movement - checking if the movement would make you collide with anything you don't want to be stuck in (as you would then be stuck in it) via your collision DnD of choice (if you're unsure what to use, consult the manual). Then, you only apply the movement if that isn't the case. This works best if your movement speed evenly divides the size of the room's grid, such as 1, 2, 4, 8... as you will otherwise end up with gaps between moving instances and walls which you'd have to take care of specifically.
 

Slyddar

Member
The part of my post that you quoted is also EXACTLY what I suggested NOT to do. I can't check what the linked video is about because YouTube's video servers seem to be down as of writing, so this may or may not be what it's actually about.
@TsukaYuriko You might of misunderstood. The quoting of you was in no way directed at yourself, I listed your quote as it was what the OP was referring to. My comment was for him only, I have full respect for you and your answers, so sorry if you thought it was directed at your post. I've added his name to my post to avoid any confusion.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I didn't think it was directed at me. :)
OP quoted my full post, not just that fragment. I merely intended to clarify that the part of my post you quoted is specifically what I advised against doing, as I thought your quote of me was in relation to the video you posted, and thus that the content of the video is about how to program collisions using solid - which, now that YouTube is working for me again, I can see is not the case. Sorry for the confusion.
 

Slyddar

Member
the video is about how to program collisions using solid
Oh no, gosh, I once tried setting up an easy tutorial of collisions using that method, and was not happy with the results. It's a checkbox that should be removed as it provides nothing but confusion for new users IMHO.
 

Mr.Fox

Member
Since you are doing a top down in DnD, try this for your collisions.

Thanks this worked, but when i wanted to change the sprite it could just walk trough again, and when i press a and w at the same time my character kinda bounces or something. Can you maybe help me fix this?
Im trying to send a video of it.
 

Slyddar

Member
In your player object, set the collision mask to be one of your sprites, like the idle sprite, if you have one. That will ensure the collision mask never changes when changing sprites, which I think might be your issue.
 

Mr.Fox

Member
In your player object, set the collision mask to be one of your sprites, like the idle sprite, if you have one. That will ensure the collision mask never changes when changing sprites, which I think might be your issue.
That didn't work for me
 
Top