Jump to content
  • Advertisement
Sign in to follow this  

Wu particles not working right

This topic is 4976 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heres the deal. I have been trying out some old-school graphics programming using TinyPTC (Check it out here). I am trying to just get some basic stuff working, right now I am trying to get wu particles working (as well as my initials spelled with dots waving in a sine wave). Information on this is hard to find, I am using this site pretty much. I am using the algorithm directly with less than optimal results. The exe can be found here zipped It is actually supposed to be my initials, though it just looks like a moving mass of dots. Anyway, the top half looks great, but the bottom dots looks pretty messed up and I have no idea why.
void plotwu(float wx, float wy, int wb)
	int x, y;
 	float fx, fy;
	int btl, btr, bbl, bbr;
	x = int(wx);
	y = int(wy);
	fx = wx - x;
	fy = wy - y;

	btl = (1-fx) * (1-fy) * wb;
	btr =  (fx)  * (1-fy) * wb;
	bbl = (1-fx) *  (fy)  * wb;
	bbr =  (fx)  *  (fy)  * wb;
	plot(x,   y  ,rgb(btl,btl,btl));
	plot(x+1, y  ,rgb(btr,btr,btr));
	plot(x,   y+1,rgb(bbl,bbl,bbl));
	plot(x+1, y+1,rgb(bbr,bbr,bbr));

This is the function, and if you want me to post more code, feel free. (I'm sure this is a stupid mistake, but I will never be able to find it)

Share this post

Link to post
Share on other sites
I have been trying out different things, and I figured out it has nothing to do with negative numbers (I thought maybe the algorithm could only deal with positive screen coords). However, the problem fails to present itself when the text is stationary, so the problem must be with the movement.

ypos = 54;
for(y = 0; y < 9; ++y)
ypos -= 4;
xpos = x_offset;
for(x = 0; x < 22; ++x)
if(text[y][x] == 1)
plotwu(xpos, ypos, 255);
xpos += 6;
//later in the code
x_offset += 100*frame_time;
if(x_offset > 160)
x_offset = -182

anyway, my method of doing movement is probably a bad way, but I don't see how it would mess up the plotwu function. I think the problem would have to lie somewhere in the code I posted.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!