Jump to content

  • Log In with Google      Sign In   
  • Create Account

BeerNutts

Member Since 27 Jun 2001
Offline Last Active Yesterday, 09:18 PM

Posts I've Made

In Topic: Stuck on collision detection/resolution

11 February 2016 - 08:52 AM


Diagonal movement is possible. If two non-conflicting keys are pressed, then the character walks both those ways

 

I meant, you can't check collisions in both directions if you're moving diagonal.  You have a variable "dir" which can only be set to left, right, up or down, so, if you're moving up and right, you can only check the collision with either up or right, not both.  that needs ot be fixed.  The easier way is to remove the dir variable all together, and just use your X and Y speed to determine which way your character is moving, so, if X is positive it's moving right, and if Y is positive, it's moving down as well.

 

Also, you need to remove the "moved" variable: If you collide with something, you are setting the moved variable to true, and that stops all other collision corrections.  This is what actually sounds like your problem, combined with the dir variable.


In Topic: Stuck on collision detection/resolution

10 February 2016 - 09:22 PM

Your direction can only be left, right, up, down, so you won't ever be checking 2 direction, so I guess you can't move diagonally?  That doesn't sound right.  So, it looks like it's only possible you'll can collide with 2 objects next to each other (ie, 2 creates on top of each other while moving right).  

 

This solution looks very incomplete.  Can you describe how you are moving, and the exact situations you have problems?  Also, it'll be helpful to post more code around how you create the BoundingBox that is being compared, and any other supporting code.

 

Finally, you can probably figure this out yourself.  You should have many debug statements in there to help you understand what's going on, or just set a break point on a case where your collision list is 2 or more.  that can help paint a picture of what's really going on.  You should learn to do this so you solve these bugs yourself, and, I promise, you'll have TONS of them as you continue to program, no matter how good you get.


In Topic: Program Stops Without Exception

08 January 2016 - 10:16 AM

It's obvious that your program is trying to create a connection to the SQLite defined by "cs", but it can't for some reason, so it blocks until it does connect.

 

You need to figure out why it can't connect to whatever is defined by "cs".  Do you have a SQLite DB running, and does cs properly point to that DB?  That is where the issue is IMO.


In Topic: Time button is pressed

07 January 2016 - 01:06 PM

Just using Windows I assume?  Sorry, I don't have any idea, outside of writing a program to do it for you.


In Topic: Time button is pressed

07 January 2016 - 12:44 PM

You're going to have to provide more detail.  Are you writing a program?  If so, what language?  Are you using any external libraries to handle input? Details, please.


PARTNERS