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

Pages: 1 [2] 3
16
Graphics / Collision detection for more than two objects?
« on: August 10, 2011, 10:28:11 pm »
I know it's not efficient that's why i posted the question. What I want to know is how to detect collision with more than two objects all at the same time... Rather if it's a thousand or 3.

17
Graphics / Collision detection for more than two objects?
« on: August 10, 2011, 10:14:04 pm »
How would I make a collision detection for 2d objects for more than 2 objects.

As in 3 object collision or possibly more?

18
General discussions / Can we see the source code for this?
« on: August 10, 2011, 08:27:06 pm »
Kool.

Thanks a lot

19
General discussions / Can we see the source code for this?
« on: August 09, 2011, 09:30:02 pm »
Can we see the source code for this library. All I see is headers and I really want to find out more about how everything is being implemented and done so I can better manipulate things and make better software.

20
Graphics / Collision Detection Problems and freezes with sprites etc
« on: August 09, 2011, 09:28:07 pm »
Hey, I was actually thinking... lol thinking.... you say that I need to use sf::Sprite::SetCenter... Why would that matter dependent on if it was sf::Shape or sf::Sprite. Shouldn't they be the same and it be totally independent on those two classes. As in since the code worked for sf::Shape then why would sf::Sprite not work and need sf::Sprite::SetCenter()?? Yup just checked... sf::Shape has a sf::Shape::SetCenter() function as well.

21
Graphics / Collision Detection Problems and freezes with sprites etc
« on: August 09, 2011, 09:27:59 pm »
Hey, I was actually thinking... lol thinking.... you say that I need to use sf::Sprite::SetCenter... Why would that matter dependent on if it was sf::Shape or sf::Sprite. Shouldn't they be the same and it be totally independent on those two classes. As in since the code worked for sf::Shape then why would sf::Sprite not work and need sf::Sprite::SetCenter()?? Yup just checked... sf::Shape has a sf::Shape::SetCenter() function as well.

22
Graphics / Class inheriting sf::RenderWindow properties.
« on: August 09, 2011, 03:37:45 pm »
I want to make a class derived from sf::RenderWindow. I'm not sure if that's a good idea or if I should just have something that is somewhat an addon but not sf::RenderWindow. This is because I want to add a lot of vectors and I don't know if that will slow down the sf::RenderWindow since it is somewhat the backbone or foundation of the whole program.

You know with drawing functions, opening it, manipulating it... Sending it through functions etc.

23
SFML projects / [RELEASED] SFMLUploads.Org
« on: August 08, 2011, 11:55:25 am »
Nice move. SFML is a growing nice multimedia library. I'm looking forward to seeing this site being developed more and the things that I will see on it.

24
Graphics / Class inheriting sf::RenderWindow properties.
« on: August 08, 2011, 11:48:47 am »
Hi, I'm wondering if making a class sf::RenderWindow properties and adding a few vectors possibly of growing and sometimes depleting memory will be too expensive to actually have act as a sf::RenderWindow?

25
Graphics / Collision Detection Problems and freezes with sprites etc
« on: August 08, 2011, 11:46:24 am »
That actually might be why. I never set the center of any sprites. I just sf::Sprite::SetPosition().

Could you give me a more in depth explanation of why this is needed? I really want to understand this. Idk I probably took 30 seconds to think about why this didn't work and my answers were completely different than sf::Sprite::SetCenter().

Also possibly how Sprites are loaded and about them etc.

Thanks

26
Graphics / Collision Detection Problems and freezes with sprites etc
« on: August 08, 2011, 06:02:47 am »
Hi, I've developed somewhat a basic little pong like ball that has to stay within certain boundaries. When dealing with a sf::shape, it doesn't have any type of bugs or errors. While using the same code as the sf::shape, if I switch it to sf::sprite with an image acting as the ball, it will freeze and be very buggy going through the boundaries set.

I'm wondering why is this? Is sf::sprite more intense and need to be implemented some other way. Should I add extra catching boundaries or possibly(just thought of now) have a exception like clause that will redraw and reimplement the ball on messing up exactly where it was last within the boundaries??

27
I know that a game engine has components that make a game easier to make. Or a lot of low level or repetitive things done to make the game producing/development a lot easier/faster.

I'm looking for a better definition, sample things that would go into a game engine(descriptive/detailed plz) and how i can use SFML to make one.

As in what would SFMLs job be in the game engine etc.

Thanks

28
Quote from: "Vit"
You've used >= instead of < (or <=).


Hmm?
Why is that a problem?
And just flipping around these two values comprising of the expression would fix this?

EDIT:Oic what you're talking about.

Thanks  both of you :D

29
Hey, I'm interested in reusable code. As I just started, I feel mines kinda bad. As it will improve obviously. But, I wanted to ask the community what type of functions/class/code do you typically find reusable? Why do you deem it reusable, and What extends or inherits that code.

30
Basically it's a "computer" that handles the paddle and watches the ball to move where the ball is going.

When the ball reaches GetPosition().x >= 400, it will start to move to where it's going. It works going down, but when it's needed to go up, it doesn't move at all.

Paddle & gBall inherit sprite characteristics

dir is a variable used within gBall to find out which direction it is going.
2 = right down 3 = right up

Code: [Select]


class Computer
{
public:
Paddle * IControl;
gBall * IWatch;
float BPD;

void Set(Paddle * CPaddle, gBall * IWatchIt);
void SetBall(gBall * IWatchIt){ IWatch = IWatchIt;}
void SetPlayer(Paddle * CPaddle){ IControl = CPaddle;}
void play();
float crunch();
void move();
};

void Computer::play()
{
if ( IWatch->GetPosition().x > 400 && IWatch->dir == 3 )
{
BPD = crunch();
if ( BPD > 50)
move();
}

if ( IWatch->GetPosition().x > 400 && IWatch->dir == 3 )
{
BPD = crunch();
if ( BPD < -50)
move();
}

if (IWatch->GetPosition().x > 400 && IWatch->dir == 2 )
{
BPD = crunch();
if(BPD > 50)
move();
}
if (IWatch->GetPosition().x > 400 && IWatch->dir == 2 )
{
BPD = crunch();
if (BPD < -50)
move();
}
}

float Computer::crunch ()
{
float copy;
if (IWatch->dir == 3 && IControl->GetPosition().y <= 300.f)
copy = IWatch->GetPosition().y - IControl->GetPosition().y;

else if (IWatch->dir ==  3 && IControl->GetPosition().y >= 300.f)
copy = IWatch->GetPosition().y - IControl->GetPosition().y;

else if (IWatch->dir == 2 && IControl->GetPosition().y <= 300.f)
copy = IWatch->GetPosition().y - IControl->GetPosition().y;

else if (IWatch->dir == 2 && IControl->GetPosition().y >= 300.f)
copy = IWatch->GetPosition().y - IControl->GetPosition().y;
std::cout << BPD << "        " << IControl->GetPosition().y << "        " << IWatch->GetPosition().y << "    " << IWatch->dir << std::endl;
return copy;
}

void Computer::move ()
{

if(IWatch->dir == 3)
if (BPD >= (-50))
IControl->Move(0.f, -.5f);  // doesn't work
if (BPD >= 50)
IControl->Move(0.f, .5f);


 
if(IWatch->dir == 2)
if (BPD >= (-50))
IControl->Move(0.f, -.5f); // doesn't work
if (BPD >= 50)
IControl->Move(0.f, .5f);

}

Pages: 1 [2] 3
anything