Re: quad tree
- Posted by doncole2009 Aug 11, 2009
- 1185 views
Hello gaz,
I don't know much about games or collisions. I ran your program but didn't study the code.
It looks to me like the bitmap is bigger than the screen.
So you have to move it around to see it all. The truck or man whatever appears to be moving around but
is stationary so you know it's screen X,Y Position. In the default mode (when the game starts)
the left side of a rectangle is showing on the right side of the screen.
You the pixels position with getRect(). If the rectangle is moved 1 pixel toward the left side
of the screen then the X pixels = X pixels-1 and so on. If the rectangle gets too close to the
truck then there's a crash Same with up and down Y pixels. You have to keep track of all the rectangles
you don't want to run into. I don't think you need any complicated math to do this.
Just my observation.
Don Cole