Any .Net programmers in the house?

Soldato
Joined
14 Apr 2004
Posts
11,888
Location
UK
I'm in need of a little help, basically I'm creating a game breakout/pong style game.

Now I've pretty much got everything programmed in VS, I have my ball moving, bat colliding, score board working, £1 coin slot working too.

Now I just need some sort of help on arrays for the bricks.

I've read up a few books and to be perfectly honest I don't understand it in a way where I could apply it to this scenario.

Thank you for your time :)
 
Help on arrays as in programming them or help as in understanding what an array is?
 
I'd just use a two-dimensional rectangular array:
Code:
private int m_BlockWidth = 10;
private int m_BlockDepth = 5;
private Brick[,] m_Bricks = new Brick[m_BlockWidth, m_BlockDepth];
Just treat the array as a grid, using x and y coordinates to get to the brick you want. Sorry if this isn't what you're after :p
 
~J~ said:
Help on arrays as in programming them or help as in understanding what an array is?
Help on programming :)

Inquisitor said:
I'd just use a two-dimensional rectangular array:
Code:
private int m_BlockWidth = 10;
private int m_BlockDepth = 5;
private Brick[,] m_Bricks = new Brick[m_BlockWidth, m_BlockDepth];
Just treat the array as a grid, using x and y coordinates to get to the brick you want. Sorry if this isn't what you're after :p
Isn't that c++?

Either way it's not working well :o
 
dark_shadow said:
Now I've pretty much got everything programmed in VS

uh huh. i assume that's visual studio you're referring to. you using c#?

you've implemented all these various things including a '£1 coin slot' whatever that might mean.

and yet you aren't sure how to put the 'blocks' into arrays?

i made an arkanoid clone in Pascal as a really early project, and i wrote it in such a way that the blocks could be loaded from file, so i edited loads of levels really easily. i think i just loaded data into arrays or something. unfortunately i lost the code years ago.

anyway, if you're using vb.net - delete whatever you've done so far. that's a good first step.
 
n3crius said:
uh huh. i assume that's visual studio you're referring to. you using c#?

you've implemented all these various things including a '£1 coin slot' whatever that might mean.

and yet you aren't sure how to put the 'blocks' into arrays?

i made an arkanoid clone in Pascal as a really early project, and i wrote it in such a way that the blocks could be loaded from file, so i edited loads of levels really easily. i think i just loaded data into arrays or something. unfortunately i lost the code years ago.

anyway, if you're using vb.net - delete whatever you've done so far. that's a good first step.
I'm using VS but the Visual Basic aspect of it. It's a module for VB programming. So that's VB stuff on VS in a nutshell.

Precisely, I haven't covered arrays. I read into it in my own free time but my vision is blurry on how to implement it. Instead of defining 50 bricks as new rectangles for bricks, I keep getting "array'd" recommendations thrown at me from many people. Yet I have a very shallow idea on it.

Hope that clarifies it :)
 
Bah no luck, been reading up on it for a few hours now.

I ended up just drawing out each brick :eek:

My two questions:

1) How can change the Timer interval with a scrollbar?

2) How do I add sound each time a brick is hit?

I've been trying the above for a couple of hours!

Would appreciate any help.

Cheers.
 
Read about arrays. Really. They're a fundamental tool in programming.
dark_shadow said:
1) How can change the Timer interval with a scrollbar?
I'd use a track bar for this, but anyway, just add an event handler for the scroll bar/track bar and change the timer's interval each time the event is raised.
dark_shadow said:
2) How do I add sound each time a brick is hit?
Not sure about this, but I'd probably use the DirectSound API (though this may be overkill).
 
Inquisitor said:
Read about arrays. Really. They're a fundamental tool in programming.

I'd use a track bar for this, but anyway, just add an event handler for the scroll bar/track bar and change the timer's interval each time the event is raised.

Not sure about this, but I'd probably use the DirectSound API (though this may be overkill).
I think I'll take out a book on VB over the weekend for arrays.

How would I go about adding an event handler? Tried using ContextMenuStrip and I didn't get far!

DirectSound does seem the best as getting WMP to play it will affect gameplay. Unfortunately google didn't return much back :(

Choas - Sorry but C/C++ isn't helping at all for vb.
 
Back
Top Bottom