• Create Account

Banner advertising on our site currently available from just \$5!

# XsoodX

Member Since 19 Oct 2012
Offline Last Active Apr 19 2015 05:32 AM

### Collideable Line Plotting

08 November 2013 - 04:34 AM

I am making a 2D physics based game using Box2D for Physics and SDL for Graphics.

I need to plot a collision line along the path of a ball(in linear trajectory) as it moves. The line should not collide with the plotting ball but other

balls(which are also plotting lines). Also if the plotting ball collides with an object, it should stop plotting that line and begin plotting another, and should be collidable with the original. The images describe what i need.

The ball has a radius which will intersect with the line if it is plotted from the center of the ball.

How can I implement this?

### SDL blitting Multiple Lines

15 October 2013 - 11:47 AM

I am making a simple physics based game using box2D as physics engine and SDL for graphics.

I need to put multiple lines on the screen using SDL_gfx.

Is there any way i could blit those lines on a SDL_Surface and then that on my Main Screen, so as to avoid calling the line creation function too many times?

### Object Collision Problem

05 October 2013 - 06:46 AM

I am trying to make a simple physics based game in SDL, and i require a ball to bounce of lines in game.

However, when the ball collides with the line, it clips through it, messing up the collision count.

The problem is due to the speed of the ball. If the ball travels fast enough, it can pass right through the line.

I use frame independent motion and a circular collision detection for the ball

How can i make sure the collision doesn't clip?

Code For the Ball Collision Detection

```bool Projectile::check_collision(Line L)
{
int X1,X2,Y1,Y2,CL;
int Cx=0,Cy=0,CP=0,Px=0,Py=0;
float shortest_distance;
double slopeL=0,slopeP=0;

L.get_Line(X1,Y1,X2,Y2);
getLocation(Px,Py);
Px+=size/2;
Py+=size/2;

if(X2-X1!=0)
{
slopeL=(Y2-Y1)/(X2-X1);
slopeP=-1/slopeL;
//Y=mX+C;
CL=Y1-slopeL*X1;
CP=Py-slopeP*Px;
Cx=(CL-CP)/(slopeP-slopeL);
Cy=slopeP*Cx + CP;
}
else
{
Cy=Py;
if(X2>Px)
Cx=X2-Px;
else
Cx=Px-X2;
}

shortest_distance=sqrt(pow(double(Cx-Px),2)+pow(double(Cy-Py),2));

if(shortest_distance<size/2)
{
if(X2-X1!=0)
on_collision(slopeL);
else
on_collision();
return true;
}
else
return false;

}
```

### SDL Release Build Problems

27 October 2012 - 12:46 PM

I have made a simple PONG game for my school project in VC++ 2010 using SDL. When i build the Release build inside VC++ it works perfectly fine, but when i try running the .exe from the solution folder, Nothing happens at all.

My SDL project does include .png files.

Can someone pls tell me how to build a proper release so that i can take it in a pendrive and install it on other comps?

### Complete Beginner to Game Development

20 October 2012 - 12:52 PM

I know the basics of C++ (Mainly Console applications) and have made many simple text based games, but i want to go further and start 2d (and later 3d) graphics, But i don't know where to start.

Can someone help me find a good book, or a tutorial site, or anything at all to get me started?

PARTNERS