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 - Finn

Pages: 1 2 3 [4] 5 6
46
SFML projects / Sketch RPG
« on: September 04, 2010, 11:34:45 pm »
Update: First Video


Update 2: New Video

47
General / Life-/Mana-bar
« on: September 01, 2010, 09:23:54 pm »
Actually....no :P
But I now finnaly figured out the right rect. :D Thank Rockstar Energydrink xD
Like this:
Code: [Select]

sf::IntRect NewRect(0,(190 - ( (float)m_life / m_max_life * 190 )),76,190);

48
General / Life-/Mana-bar
« on: September 01, 2010, 01:51:36 pm »
But what we have now looks like this ->

I think I have to do it the other way round. Now we cut off the bottom and set the sprite lower. But it has to cut off the top!

I messed around with different rects, but somehow I don't get it O_o

49
General / Life-/Mana-bar
« on: September 01, 2010, 01:01:04 pm »
Ah yes....I remember.. :D thx^^ works :)

50
General / Life-/Mana-bar
« on: September 01, 2010, 12:19:37 pm »
Even though it seems there's something wrong :-/ No matter how much the life should be reduced. No matter if life is 0 or 50 or something else it always sets the position to 768!(Screenresolution: 1024x768)

51
General / Life-/Mana-bar
« on: August 31, 2010, 08:39:30 pm »
This is how I use it

Code: [Select]

void character::Dec_Life(int Damage,sf::Sprite& Lifebar)
{
m_life -= Damage;
Lifebar.SetSubRect(sf::IntRect(0,0,95, m_life / m_max_life * 190));
Lifebar.Move(0, (768 - 190 + ( 190 - (m_life / m_max_life * 190))));
}


m_life is an integer that represents the life. m_max_life is the maximum life you can have.

52
General / Life-/Mana-bar
« on: August 31, 2010, 12:49:06 pm »
Hm. I have some problem with setting the right SubRect. I tried it as BeSaladin said. If I want to have full life it works. But if I reduce life by 1 the lifebar is gone and can't be seen anymore :-o

53
General / Life-/Mana-bar
« on: August 30, 2010, 12:04:15 pm »
Ah k...after reading thorugh the posts a few times I now understood what you mean :) Sounds easy and good! I think I'll try it ;)

54
General / Using the Collision-Detection
« on: August 29, 2010, 11:40:58 pm »
Yes. That's how I solved it ;) Thanks anyway

55
General / Life-/Mana-bar
« on: August 29, 2010, 11:40:16 pm »
Jep I thought of this,too. But the problem is that the background needs a transparent hole. This is what i don't have. The Background will be the map. The red here is the map:
http://image-upload.de/image/mUm2aP/f7f07818d8.png

56
General / Using the Collision-Detection
« on: August 28, 2010, 03:59:00 pm »
No answers?

57
Window / How to use sf::Window::ShowMouseCursor(); properly?
« on: August 27, 2010, 11:05:02 pm »
I've noticed that with Linux u have to put it into the GameLoop. So every loop the Mousecursor is invisible. If you just call it once somewhere it changes back to true, somehow :-S

58
General / Using the Collision-Detection
« on: August 27, 2010, 06:35:21 pm »
So...to go on with this, how to do this for multiple sprites? For example for every sprite on the gamemap?
Put all the sprites into a vector?

59
General / Using the Collision-Detection
« on: August 27, 2010, 06:14:57 pm »
THX! :D Works without any problems :D
This is how I solved it together with backgroundscrolling:

Code: [Select]

   if(Input.IsKeyDown(sf::Key::Right))
{
Player.ChangeAnim(2);
Player.PlayAnim();

Player.Sprite.SetPosition(XPos+Player.Speed,YPos);
GameView.Move(Player.Speed,0);

if(test.PixelPerfectTest(Player.Sprite,CBox))//if collision
{
Player.Sprite.SetPosition(XPos,YPos);//reset the sprite
GameView.Move(-Player.Speed,0);//reset the map
}
return;

}


same for the other directions...
Thx,
Finn

60
General / Using the Collision-Detection
« on: August 27, 2010, 02:42:32 pm »
Hi
I'm using this collision-class http://www.sfml-dev.org/wiki/en/sources/simple_collision_detection !
It works perfect! ;)
But now I try to figure out how to use this in the way, that my character can't walk through an other sprite...
I tried something like this:
Code: [Select]

const sf::Input& Input = window.GetInput();/

float ResetValue = 1.0f;
float XPos = Player.Sprite.GetPosition().x;//Position of the player sprite
float YPos = Player.Sprite.GetPosition().y;

if(Input.IsKeyDown(sf::Key::Right)
    if(test.PixelPerfectTest(Player.Sprite,TestBox))//Testbox is a sprite
        Player.Sprite.SetPosition(XPos-ResetValue,YPos);
    else
        Player.Sprite.SetPosition(XPos+Player.Speed,YPos);


But this is ugly. If the player is colliding it shakes back and forward. Also It seems this is a little bit buggy.
Is there a better way to do this?
Greets,
Finn

Pages: 1 2 3 [4] 5 6
anything