Path: utzoo!attcan!uunet!garfield!sean1 From: sean1@garfield.MUN.EDU (Sean Huxter) Newsgroups: comp.sys.cbm Subject: Sprite Collision detection in M/L on the Commodore 64. Or: HELP! Message-ID: <5103@garfield.MUN.EDU> Date: 13 Mar 89 23:29:36 GMT Reply-To: sean1@garfield.MUN.EDU (Sean Huxter) Distribution: na Organization: Memorial University of Newfoundland Lines: 57 I am an experienced programmer in BASIC on the 64 and 128. I own a 128 with 1571, 1581, 1750 REU and am an avid user of GEOS. I have always wanted to program for GEOS, but unfortunately, this can't be done in BASIC. So I was forced to delve into M/L which is tedious. Using geoProgrammer made it easier, and having both Alex Boyce's and Berkeley's Programmers' Reference Guides helped. I discovered how to extend GEOS's main loop so I could write a program that didn't rely entirely on events. Now, the point of this posting is that I invented a rather simple game which requires detection of collision between a sprite and the background and another sprite. I have done this kind of programming in BASIC (both 2.0 and 7.0) many times, but the routine I wrote in M/L will not work. Here is what my routine looks like, basically: start: CmbBI $D01F,0 ; a macro for comparing the contents of ; $D01F, the background collision register, with 0. bne Collision rts Collision: ; code here to reset the pointer to beginning, and make beep. Now, my problem is that the collision register never seems to be anything but zero, which seems wrong, since I can move the sprite (which is sprite #0, the GEOS pointer) over graphics and nothing happens. The routine has an rts since it is called from the GEOS MainLoop every time MainLoop executes. The code is pointed to by appMain. I have successfully placed other pieces of code in this place which executes perfectly each MainLoop, but this doesn't work. My question to anyone out there with M/L experience is: Why does this not detect the collision when it clearly happens? Does GEOS clear the collision register each MainLoop? Am I programming it incorrectly? Or, more succinctly: HELP!!!! /| / / // Sean Huxter |UUCP: {utai,utai, ____/_/__ __ | | P.O. Box 366 | watmath}!garfield!sean1 -=<_________|__|=|<< Springdale |INTERNET: sean1@garfield.mun.edu \ \ | | NF, Canada | \ \ \\ A0J 1T0 | "THUNDERBIRDS are GO!" \| -- "And remember, Evil will always prevail because Good is dumb!" - Dark Helmet "Smoke 'em if ya got 'em." - Dark Helmet / Elliot Ness / Colonel Hogan / Judge Harry Stone / Christine Sullivan, public defender.