• Create Account

# Carlows

Member Since 16 Jun 2013
Offline Last Active Dec 15 2013 06:44 PM

### In Topic: SFML - Acceleration in Space?

30 June 2013 - 11:37 AM

I would just keep one vector for the speed, then add the normalized mouse direction vector to it:

```Vector2f position;
Vector2f speed;

void Nave::update(sf::Time& delta, sf::Vector2f mousePOS)
{
float mouseMagnitude = sqrt(mousePOS.x * mousePOS.x + mousePOS.y * mousePOS.y)
mousePOS = mousePOS / mouseMagnitude;  // probably need to divide this by some constant, too.
speed += mousePOS;
position += speed; // * delta if this is not called at regular intervals
}
```

I think that doesn't change anything on the behavior...

I think it does: I am treating the speed as a vector, while your "acceleration" (actually speed, I think) is a scalar.

You were right, my fault. Thanks!

### In Topic: SFML - Acceleration in Space?

29 June 2013 - 09:44 AM

I would just keep one vector for the speed, then add the normalized mouse direction vector to it:

```Vector2f position;
Vector2f speed;

void Nave::update(sf::Time& delta, sf::Vector2f mousePOS)
{
float mouseMagnitude = sqrt(mousePOS.x * mousePOS.x + mousePOS.y * mousePOS.y)
mousePOS = mousePOS / mouseMagnitude;  // probably need to divide this by some constant, too.
speed += mousePOS;
position += speed; // * delta if this is not called at regular intervals
}
```

I think that doesn't change anything on the behavior...

### In Topic: SFML - Acceleration in Space?

29 June 2013 - 07:11 AM

On a side-note; can I ask, where do you declare the variable 'aceleration'? There is also another variable 'acceleration' and these seem to be interchanged within the function, and its first usage. Is this just a typo? Or are you making use of the wrong variable at the wrong time?

Lol, that was my error traducing the code to English

### In Topic: SFML - Is there a way to implement lights?

28 June 2013 - 09:19 AM

Here's a link describing how to do make the glow around your objects.

Begginer question here, does gimp have a way to paint all the silhouette white?

Edit: Solved, but i think my gimp have a bug, when i apply the DoG all the layer gets transparent, what the..

### In Topic: SFML - Is there a way to implement lights?

27 June 2013 - 05:01 PM

For lighting, I use a matrix of black pixels with different transparency values and draw them on top of my image. Depending on the lighting in that area, the transparency is changed.

Cheers !

Hmm, that sounds simpler, the problem is that every bullet is a mini-circle, it has the same color all over it, I try it, but I can't see any difference, lol

PARTNERS