Collision problems

Non-platform specific questions.

Collision problems

Postby BloodRedDragon » Tue Apr 05, 2011 10:31 pm

I have a 'player' actor with a spherical animation for a platform game. The gravity is Draw Actor-Script-yvelocity+=1; and it is moving at a constant speed of xvelocity 8. When it collides on the left or right side of a box, it changes direction (the velocity is reversed). When it collides with the top side of the box, it lands on top of it and the xvelocity is unaltered. When the bottom, it sticks to it until the user presses down.

(do not steal this idea) :D

But i find the player going through blocks in some cases where the player may end up colliding with the top and left/right at the same time, or colliding straight after having collided with another box. This hinders one of the game's sections.

I would post a demo but I would rather do that when it is finished.

Note: I do not have any collision-physical response events between the boxes and the player,could that be the case? I did have some but I got rid of them becuase they weren't working the way i wanted them to.

Thanks for reading.
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Collision problems

Postby skydereign » Wed Apr 06, 2011 12:01 am

It is kind of hard to tell without the code in the events (also it'd be nice to know how the player is passing through the blocks such as which one), but this is the first thing that comes to mind. I assume you are not having the collision events repeat. When the player collides with a box, you have code to alter their velocities. The problem is, the actor is still partially colliding with the same box, so the event doesn't trigger again when you start moving up. The left and right collisions don't need this but the top collision would, assuming of course that is the problem you are having. To fix this you would insert this code into it the collision with the bottom of the box.
Code: Select all
y=yprevious;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Collision problems

Postby BloodRedDragon » Wed Apr 06, 2011 10:00 pm

That did help, but I still have problems. Hopefully I'll get them sorted out :D
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest