Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Paijan

Pages: [1]
1
Graphics / Re: Comet tail
« on: July 11, 2015, 03:33:02 pm »
Thank you for your replies.

I decided using VertexArray and the tail works perfectly. I even tried fading it by iterating through all vertices and changing their alpha values calculated from quadratic function (to make it smooth). It looks nice.

Should I somehow dispose of faded vertices? Because they are faded, but they still exist in memory and are drawn each frame.

2
Graphics / Re: Comet tail
« on: July 09, 2015, 02:09:42 pm »
Quote
If you want the tail to be contiguous and stay behind you could simply draw a line between each of the points denoting the previous positions.

You mean storing coordinates each frame and appending it to VertexArray?

EDIT: Well, it really works fine, only now I can't alter line thickness

3
Graphics / Comet tail
« on: July 09, 2015, 01:40:53 pm »
I'm writing a game in which moving objects leave tails behind themselves, like comets. Objects can be moved either by player input or mathematical function (e.g. on sinusoid).

I couldn't find a good way to perform this so I tried the simplest one - creating CircleShape in regular intervals in objects' positions. And it worked, because of simplicity, but later on it became a performance bottleneck. It's snappy and the tails sometimes break -pics.

How to do it properly? Thor particles?

4
Graphics / Pixel Perfect Collision Image Problem.
« on: November 06, 2014, 11:55:10 pm »
Hi.
I'm writing a code, which performs pixel perfect collision check.
It creates sf::Rect which is rectangle of collision.
Then it transforms its coordinates to sprites' local (referring it to 0,0 points of both sprites).
Then I can use those coordinates to choose pixels in sf::Image entities which are created from the same texture as sprites (it has to be sf::Image because spirtes don't have getPixel method) and check their alpha channels.

And it works perfectly fine until i try to scale my sprites in main loop. Then coordinates in sprite don't match coordinates in image, because one of them is scaled.

How do I manage this? Should I somehow scale sprite back to it's original size at the beginning of function?

(click to show/hide)

Pages: [1]
anything