Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Collision Problem

Years of Service
User Offline
Joined: 29th Jun 2012
Posted: 30th Jun 2012 04:50
Hello, I'm pretty new to programming, and I'm currently making a 2D game. The problem I'm having has to do with collision. I'm trying to make collision with boxes on screen, and it is working for the most part. However, when I move my player Left and Down Diagonally towards the right side of the box, I go through it. This also occurs when I move Left and Up Diagonally toward the bottom of the box. I've been trying to fix it for a while now, but I'm not having any luck. Here's the code:

Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 2nd Jul 2012 07:25
Ok, you need to do a piece-wise movement. Fist move left-right then check for collisions and compensate. Then move up-down then check for collisions, then compensate.

Login to post a reply

Server time is: 2023-10-02 02:28:59
Your offset time is: 2023-10-02 02:28:59