No, I said what I meant.eatcomics wrote:vertically with the ground you mean? most walls are verticaldandymcgee wrote:How do you collide vertically with a wall?thejahooli wrote:Yes, as he comes down he detects a collision with the wall, but thinks it's the ground as it is colliding vertically.N64vSNES wrote:I think I understand, Are you saying that if the player hits a wall in mid air then as he comes down it detects a collision from the ground and lets him stand?.....I think thats what you said correct me if I'm wrong
Platformer Collision Help
Moderator: PC Supremacists
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Platformer Collision Help
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Platformer Collision Help
Just to confirm this is how the collision is acting?
EDIT: Just a thought but are you updating collision and then updating players position, or updating the players position and then collision?
EDIT: Just a thought but are you updating collision and then updating players position, or updating the players position and then collision?
Re: Platformer Collision Help
I know this thread is kindof old and you have probably fixed it by now, but as in my eyes it came to no clear conclusion, I would like to say that once had this problem as my tiles were smaller than my player(the player itself wasn't tile-based so there weren't exact collision detection and he would float by the sides of walls)
So my fix to it was if the tile above the tile that you are testing collision for is solid( e.g., you an collide with it) then there is no way that there has been a collision with the ground on that specific tile.
Hope This Helps anyone who comes across this
So my fix to it was if the tile above the tile that you are testing collision for is solid( e.g., you an collide with it) then there is no way that there has been a collision with the ground on that specific tile.
Hope This Helps anyone who comes across this
Re: Platformer Collision Help
What do you use C++
Re: Platformer Collision Help
I use c++ but the theory is the same for everything
- thejahooli
- Chaos Rift Junior
- Posts: 265
- Joined: Fri Feb 20, 2009 7:45 pm
- Location: London, England
Re: Platformer Collision Help
Sorry that I didn't show how I fixed it. I'll post a description and then my code in spoiler tags so that you can see the code
First I found the outer tile positions that the object will be touching when only moved by it's x velocity. Then, depending on which direction the object is moving, check the collisions for all the tiles it could be touching using the outer tile positions I found out, starting from whichever tiles it would hit first for the direction in which it is moving (left side when moving right and right side when moving left). If the tile is solid, I set the objects position to outside the tile and it's x velocity to 0, and stop performing collision detection for this section.
Then I repeat this, but with the position only being changed along the y axis and the variables used changed accordingly. As well as this, I set a boolean variable called 'isOnGround' to false each frame and, if there is a collision detected when moving downwards, I set it to 'true'. Each frame when the object is updated, a gravity value is added to the y velocity so that there is still a collision downwards when just standing on the ground.
Sorry if this is not very clear, I'm not very good at explaining things. If you have any further questions just ask.
Edit:
First I found the outer tile positions that the object will be touching when only moved by it's x velocity. Then, depending on which direction the object is moving, check the collisions for all the tiles it could be touching using the outer tile positions I found out, starting from whichever tiles it would hit first for the direction in which it is moving (left side when moving right and right side when moving left). If the tile is solid, I set the objects position to outside the tile and it's x velocity to 0, and stop performing collision detection for this section.
Then I repeat this, but with the position only being changed along the y axis and the variables used changed accordingly. As well as this, I set a boolean variable called 'isOnGround' to false each frame and, if there is a collision detected when moving downwards, I set it to 'true'. Each frame when the object is updated, a gravity value is added to the y velocity so that there is still a collision downwards when just standing on the ground.
Sorry if this is not very clear, I'm not very good at explaining things. If you have any further questions just ask.
Edit:
Click here to see the hidden message (It might contain spoilers)
I'll make your software hardware.