View Single Post
Old 7th April 2003, 01:02   #66
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
Well. As long as your sprite has a black border we can do this one fine with some cheaty psuedo 3D code. Here is a simple dm that I quickly wrote to demonstrate this.

Per Frame:

dz=sin(t)+1.2;
dx=cos(t);
dy=sin(2*t);
t=t+0.01;
z=1/(dz*0.5);

Per Point:

x=(x+dx)*z;
y=(y+dy)*z;

This works fine z for co-ordinates strictly greater than zero. Here dx, dy and dz represent the displacement of the sprite in the varying axes. A gridsize should be set for this, preferably large since it has to shrink the sprite sometimes. Set wrap to 'off' and we are done. If you want to draw the sprite over a background then simply chuck it in an effect list and use additive blending.

Unless you want your sprite to rotate in 3D too then this should be enough.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote