delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/17:19:24

From: "Mike Winsor" <mwinsor AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: djgpp crashes under DOS 7
Date: Fri, 9 May 1997 17:03:15 -0230
Organization: Student
Lines: 12
Message-ID: <5l2ige$mko$2@nova.thezone.net>
References: <5komvl$rc7$1 AT newsflash DOT concordia DOT ca>
NNTP-Posting-Host: gnat.thezone.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I had it running under the dos box and vanilla DOS 7... in fact that's how
I would boot the computer... I had it going to DOS instead of booting
windoze.  Maybe it has something to do with your particular setup?
--
E-Mail me at:
mwinsor AT hotmail DOT com or tape_worm AT geocities DOT com

Check out my game in development:
http://www.geocities.com/siliconvalley/park/2120



 and improved ARKANOID like game
> and a ball can have collisions from many different angles. How would I go
> about doing this. Can someone get me started on a collision with my paddle?
> My paddle has 3 'bounding boxes' (my 'paddle' thing looks like o--o). The
> sides are different from the middle, so I want to detect different
> collisions in the different parts.

Here's a picture of what I think you're saying:
  _______                            _______
 |       |__________________________|       |
 |   A   |____________B_____________|   C   |
 |_______|                          |_______|

Each of A, B, and C are seperate bounding boxes.  And you want to detect a
collision such that if the ball hits B or the top sides of A and C, the
ball's vertical velocity becomes the negative of itself.  If the ball
touches either side of the A or C boxes, the ball's horozontal velocity
becomes the negative of itself.

If this is what you want, detecting B is easy since it doesn't matter
where it hits.  A and C, however is somewhat more tricky.  I would try
dividing A and C into three smaller bounding boxes apiece as folows:
 _________                          _________
|\___E___/|                        |\___I___/| When the ball hits E, G or
| |     |F|                        |H|     | | I, you negate the vertical
| |     |_|________________________|_|     | | velocity, and when the ball
|D|     |______________G_____________|     |J| hits D, F, J, or J, negate
| |                                        | | the horzontal velocity.
|_|                                        |_|

This is the easiest way I can think of to solve the problem.  Another
technique you could use is to keep A and C as single boxes.  When the ball
hits one of them, compare the position of the center of the box with the
position of the ball.  If the ball's position lies within a predetermined
area of the box that you have determined as the "top", take the appropiate
action.
 ________
|\ Top  /| Likewise, if the ball falls within the area of the left or
| \    / | right side, do what needs to be done.  Of course, if the ball
|  \  /  | hits the top and a side at once, both of the velocities will be
|Lt \/ Rt| negated which is exactly what you want to happen.
|___|____|

-Richard Ellwood

-- 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019