return to breakout

Started by
26 comments, last by L. Spiro 11 years, 3 months ago
sorry beer
Advertisement
don't give up on me yet
well I am using the code that sam gave to me.

well here it is


if(	g_bBlock[4].m_bActive_three==true)	
	{
	if(x>=3.0f && x<=5.0f && y>=3.5f && y<=4.0f)
	{
	ystep = -ystep;
	bricks[2][4]=true;
	g_bBlock[4].m_bActive_three=false;	
	}
	}

So I want to chime in on this, maybe a modification of your code into something that resembles the naming conventions of BeerNutts (will remove magic numbers/ambiguity) might help you to understand:


// Start a loop to loop through all the block
for(unsigned int i = 0; i < MAX_BLOCKS; i++)
{
    // We check to see if blocks are active
    if(g_bBlock[i].isActive)
    {
        // If there is a collision with one of these blocks
        if(ball.x <= g_bBlock[i].width
          || ball.width >= g_bBlock[i].x
          || ball.y <= g_bBlock[i].height
          || ball.height <= g_bBlock[i].y)
        {
            // Then switch the block to inactive
            g_bBlock[i].isActive = false;
            // I assume yStep is the speed the ball is going?
            // If so it is reversed and the ball move backwards.
            yStep *= -1;
        }
    }
}

I have commented each step to assist in understanding. See if you understand this and get back to us, tell us what is going on. Try not to code with so many magic numbers, it makes it nearly impossible to understand later, when attempting to convert to use variables.

Regards,

Stitchs.

actually the code I am using works just fine all I need to do is get the scoring to work
Man, I really hate to be a dick
Then let me be one for you. Everyone knows my reputation right?

phil67rpg, stop programming.
I said last time that I would not go so far as to say that until next time. Now it’s next time.

It is known that I have a tendency to be direct, and the fact is I have been a bit soft/indirect with you to this point.
But it’s obvious now that others are feeling the same frustration I have felt with you. In fact I have only been so “kind” because I thought you were perhaps 10 years old and just trying to get a start on things.


Now you are sitting here saying you have a degree?
Enough.


Some people are meant for certain things. I am sure you have your calling, but it is not related to programming. I can promise you that.
Stop wasting your time on programming and start trying to find out what it was that you were meant to do. Knowing now that you are twice as old as I thought you were I literally have no choice but to say this for your own good. I used to think you were wasting our time. Now I realize you are wasting your own time.

You are too old to be chasing this dream of programming. You need to find your calling and start generating income.


Anyone who knows your reputation will agree, but I am probably the only one willing to actually say it.
You can’t program and you will never be able to do so.
Just stop trying. Move on and find your calling. Which I guarantee is the opposite of programming, whatever that is.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

well then what should I do spiro, I was thinking about persuing art.

GameDev.net is not the appropriate place to ask what you should do with your life.
It is also not where you should find out what not to do with your life, but you should consider yourself lucky that it happened.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement