Title: | AMIGA NOTES |
Notice: | Join us in the *NEW* conference - HYDRA::AMIGA_V2 |
Moderator: | HYDRA::MOORE |
Created: | Sat Apr 26 1986 |
Last Modified: | Wed Feb 05 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 5378 |
Total number of notes: | 38326 |
Hi, anyone tried using AmigaBASIC for any 'object' graphics programming. At the moment it's the only language I've got so I'm playing around animating sprites etc. I have had a few problems. One is collision detection. I created an object with the object editor (supplied on the EXTRAS disk) and tried animating it. I used the example shown with the object.shape statement in the basic manual. So it was supposed to rebound from the edges. This it did most of the time, but every once in a while the object seemed to get 'stuck' between the border and something else. After experimenting, the conclusion I came to was that the collision detection routines were in fact detecting a second collision with the same border. This caused my collision handler to reverse the object direction again causing it to plow back into the edge. So setting up an oscillating state. I got around it with two different mechanisms. The first was once collision was detected, I moved the object away from the offending border by changing the relavant X or Y coordinate. This seemed to work quite well and if the size of the shift small enough, it was not apparent to the eye. The second method was to check to see what direction the object was moving in when the collision was detected. For example: if the object was moving to the left (i.e. negative x velocity) and the collision detected was with the left border then I would reverse the x velocity causing the object to rebound. However if the velocity was positive (moving to the right) and the collision was with the left border then I do not reverse the velocity. Am I doing something wrong, or is there bugs in the collision detection part of the Amiga or maybe BASIC. Have other people had problems with collision detection in other languages. regards Mike (Melbourne, in the Land Downunder)
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
1037.1 | Yup, it's a bug | KIBITZ::KAUFMAN | Wed Mar 09 1988 13:39 | 15 | |
I don't have any solutions for you, but can confirm your sanity by saying I've had the same problems and discovered pretty much the same solutions. As you have probably also discovered, even though BASIC tries to make the interfaces to sprites and bobs identical, they have different bugs. It's easier to get around the bugs in sprites - change direction based on wall hit and not just previous direction. Bobs tend to leave small smears on the screen. I haven't found a way to avoid them yet. The animation in BASIC was a good idea, and seems to be well designed from a user interface point of view, but I have pretty much given up on it for even semi-serious work. Good luck. |