Article View: comp.sys.amiga.tech
Article #10759Re: Simple sprite help please
From: John Schultz
Date: Sat, 31 Dec 1988 02:58
Date: Sat, 31 Dec 1988 02:58
38 lines
1896 bytes
1896 bytes
In article <160@csd4.milw.wisc.edu> gregm@csd4.milw.wisc.edu (Gregory Jerome Mumm) writes:
[stuff deleted]
>my controlling it. In other words the 'missle' keeps going without
>me having to keep move it one pixel at a time. I envision a procedure
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You're gonna have to move it yourself, as there is no "Magic" way
of doing it in parallel. The code can look like this:
INC(MissileX,deltaX);
INC(MissileY,deltaY);
MoveSprite(ViewPort,MissileSprite,MissileX,MissileY);
You'll need to do bounds/collision checking too.
Just place in your main animation loop.
>Last but not least I need to know when a missle hits one of the space ships.
If you are only using 2 opposing spaceships, each with independent
missiles, then you can check the Sprite Hardware Collision Register
(Explained in the back of the Hardware manual) for collisions. Only certain
pairs register collisions, so choose carefully.
For more complex animation, use a "Proximity" equation like:
PROCEDURE proximity(x,y,enemyx,enemyy,
width,height : INTEGER): BOOLEAN;
BEGIN
RETURN (ABS(x-enemyx) < width) AND (ABS(y-enemyy) < height);
END proximity;
This function will return TRUE when the "rectangles" defining your
shapes overlap.
>Csnet: gregm%uwmcsd4@uwm Greg Mumm
Hope this helps.
John Schultz
Technical Details
Message-ID:
<40@sdcc10.ucsd.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!ucsd!sdcc6!sdcc10!cs161agcReferences:
<160@csd4.milw.wisc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!ucsd!sdcc6!sdcc10!cs161agc From: cs161agc@sdcc10.ucsd.EDU (John Schultz) Newsgroups: comp.sys.amiga.tech Subject: Re: Simple sprite help please Message-ID: <40@sdcc10.ucsd.EDU> Date: 31 Dec 88 02:58:24 GMT References: <160@csd4.milw.wisc.edu> Reply-To: cs161agc@sdcc10.ucsd.edu.UUCP (John Schultz) Distribution: na Organization: University of California, San Diego Lines: 38