Hello strangers,
sorry I've been away so long, been very busy.
However I am very pleased to see how you have all gotten into the spirit of the team in my absence; the main principle that I founded this team on is that it is not under the sole responsibility or ownership of any one person, those who rise to the challenge become the new leaders of the team.
There have been a few comments about how crowded this thread is getting. I think this should remain as the "watering hole" for the group but when individual projects are started new threads should be made to cater for them (exclusively).
The main stumbling block for all of us is how to organise the group over the internet. BN2 seems to be gearing up to be producer on a text adventure, I will also be running the pong project, so hopefully with these starter projects we can work out the best way to organise the team.
I have high hopes for the team, if we succeed in getting off the ground with these projects we could become a permanent fixture of the forums, maybe even get our own board! lol
I'll have a look at your code for pong, if you want to work on pong please post so I know who I'm working with.
I've written a complete pong game to prepare for this so that should make it simpler.
I will of course be offering help to BN2 and his team and will welcome any support for my project.
[EDIT]
@DD & Irojo
I've looked at your code and it's clear you are both capable of writing good programs, it's just neither of you can write a program well lol. Sorry if that sounds a bit harsh but I'm talking about your code structure; it's quite hard work to follow your programs and work out what they do, and it'd be even harder work to try and alter them.
I want you both to practice using subroutines properly, and only ever have one DO LOOP, there is never any reason to have two, some people say you should never even have one! The reason for that is it restricts the flow of your program.
The way I work is by writing a block of code in the main loop and when I can see a suitable chunk that is pretty much independent I cut it out and make it a subroutine or function, whichever is more appropriate. This is great for editing as you are left with neat gosubs and your main loop consists of only a few lines of (hopefully descriptive) gosub names.
Indenting is something you are both a bit confused about, although Irojo seems to be getting the hang of it now."If you have a command that takes up more that one line, indent the lines within the command so you can see where it begins and ends". It's as simple as that and makes bug catching 1000 times easier.
I'm going on about structure because it is probably the most important thing when working in a team; after all, other people have to be able to understand, use and edit your code.
One more thing: You're both going about the physics in the wrong way, Irojo has clearly put a lot of effort into a very elaborate string of multiple if statements, but you should be thinking about angles, the ball can travel in any direction (360 degrees) and it is actually very simple to alter it's direction after collisions. You simply reflect the angle against an imaginary plain; like a real ball hitting a wall the angle coming off the wall will be exactly opposed to the angle it impacted at.
To do the physics you need to use sine and cosine and work out how to use an imaginary plane.
I'll give you a quick lesson:
As you may already know, sine and cosine can be used to draw a circle by assigning one axis to sine and the other to cosine.
The way the circle is drawn is by using a central point and drawing a dot at the x and y offset given by the angle's value in sine and cosine (you would multiply this out to give the circle width as sine and cosine are -1 to 1).
So by sticking to a single angle we can fix the x and y offset as a new co-ordinate, then we repeat the process with the new central point and our ball is moving along in a constant direction.
x= 320
y= 240
a= 35 : `angle of movement
for n= 1 to 20
dot x,y
`new co-ordinate
x= x+ sin(a)*5
y= y+ cos(a)*5
next n
Try changing the angle and see what happens.
Now let's reflect the line off an imaginary plane.
There are two planes we'll need for pong: horizontal and vertical, but you could use a plane of any angle.
x= 320
y= 240
a= 35 : `angle of movement
for n= 1 to 40
dot x,y
`new co-ordinate
x= x+ sin(a)*5
y= y+ cos(a)*5
`reflect the line at half way
if n =20 then a= wrapvalue(360-a) : ink rgb(255,0,0),0
next n
We've reflected the line horizontally by subtracting the angle from 360; the number we subtract our angle from is the plane of reflection. 360 (or 0) is a vertical plane.
180 is a horizontal plane and will reflect the line vertically.
x= 320
y= 240
a= 35 : `angle of movement
for n= 1 to 40
dot x,y
`new co-ordinate
x= x+ sin(a)*5
y= y+ cos(a)*5
`reflect the line at half way
if n =20 then a= wrapvalue(180-a) : ink rgb(255,0,0),0
next n
You should be able to work out how to make the line reflect in any direction now by altering the plane of reflection.
It is far better to complete a 10 line program than to start a 10,000 line program.