Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


AhmedCoeia

Member Since 21 May 2012
Offline Last Active Yesterday, 11:56 AM

Posts I've Made

In Topic: Game programming is hard

14 March 2015 - 02:09 PM

I have mental sickness bipolar disorder :). and I'm thinking to be hospitalized again ( I was last two months ) . 

 

Frob, what do you recommend to improve my programming skills ? 

 

I have made that software alone  I was the lead.

My skills are getting down and down since I was hospitalized :S 

 

I need a guide and I will follow it, like do those projects to restore ur self confidence... Now I'm working on space invader and I can't finish. 


In Topic: space invaders barriers implementation

14 March 2015 - 04:27 AM

I adjusted the bounding box's y size to be the difference between current position and last position.

 

Now for the algorithm that you posted earlier, there is a chance that the bullet intersects with the bounding rect, and there is black, but in the next frame, there is green and the bullet misses that part that it should hit, because the intersection test  is tested once... how do I fix that ?


In Topic: Game programming is hard

12 March 2015 - 03:41 PM

he threated me last employee appraisal of getting fired if my performance won't be better. I lost the confidence in software development in general. I suck :S 

 

I looked at your project its very nice. Can I work with you ? Maybe I learn more ? 


In Topic: space invaders barriers implementation

12 March 2015 - 02:32 PM

What I understand is, the bullet is so fast and sometimes the collision doesn't work, and it skips, but why ? I don't know.. the cpu should be fast enough to process collision that fast. 

 

I tried to record the prevposition of the bullet and use it in the calculation, as shown:

 

void Bullet::Update(float dt)
{
Position.y -= 0.50 * dt;


Vel = (Position - prevPosition).GetNormalised();


if (Position.y < 0)
{
IsDestroyed = true;
}
else
IsDestroyed = false;


prevPosition = Position;
}

and for intersection

 

 if (IntersectsWith((*it)->BoundingRect, barrierRect))
{
cRect bounding = Intersection((*it)->BoundingRect, barrierRect);
// subtract (*it) bullet position from barrrier's rect 
int normX = (*it)->prevPosition.x + (*it)->Vel.x - barrierRect.x;
int normY = (*it)->prevPosition.y + (*it)->Vel.y - barrierRect.y;


// barrier image pixels 
uint32* ptr = (uint32*)pixels;
// height of the barrier


int pixelOffset = normY*51 + normX;
unsigned int color = ptr[pixelOffset];
// look up the color if its not black, it should be green
if (color != 0xFF000000)
{
// delete the bullet
Bullet *bullet = *it;
it = ship->Bullets->erase(it);
delete bullet;
ship->Canfire = true;
isCollision = true;


// blast a circle around that bullet hit position
int radius = 9;
for (int y = -radius; y <= radius; y++)
{
for (int x = -radius; x <= radius; x++)
{
if (x*x + y*y <= radius*radius)
{
int j = x + normX;
int i = y + normY;
int pixelOffset = i*51  + j;
ptr[pixelOffset] = 0xff000000;
}
}
}


}

but I still gets in-accurate collision detection and blasting circles :S

 
 

In Topic: space invaders barriers implementation

11 March 2015 - 12:58 PM

when I made the bullet slower, everything works fine actually.. so should I store its previous position and use it in the calculation ?


PARTNERS