Hi.

Remember that the braces indicate a block of code. If I made a suggestion, it would be that you have the habbit of understanding what a block of code is, and you start out by building the block, then fill it in afterwards. In that way, you often times will have an easier time making your opening and closing braces when they're just a couple of lines from one another, and then as you fill in your function between them or your conditional or what have you, as long as you don't put an open brace somewhere that you forget a closing brace for for instance a conditional inside there, you'll be fine. Let's try an example.

void fireRocket
{

}

I like to start just like that, I also like to do this

void fireRocket
{ //this function subtracts one from our number of rockets, plays the rocket firing sound and if it hits, calls the takeDamage method on the enemy.

} //end of fireRocket

So with my commenting I've just made it rather obvious what the braces are for. Let's assume I started my function like that, now I'll fill it in a bit

void fireRocket
{ //this function subtracts one from our number of rockets, plays the rocket firing sound and if it hits, calls the takeDamage method on the enemy. if (this.numberOfRockets<1) {alert("error", "There are no rockets to fire!"); return;} //make the function stop here if we're out of rockets
this.numberOfRockets-=1; //subtract a rocket so the code knows we used one
this.playRocketFiringSound(); //calls our method that deals with the rocket sound int chanceToHit=random(1, 5); //roll a 1d5 we'll use this to determine whether the rocket hits
if (chanceToHit==5)
{ //we have a successful hit
alert("ker boom!", "The rocket collides with your enemy and explodes in a spectacular display of deep purple fire!"); this.enemy.takeRocketDamage(); //call our enemy's damage function to make it get hurt
} //done hitting successfully
else {alert("Swoosh!", "The rocket hits absolutely nothing, and, after sputtering and running itself out of fuel, continues gliding further away uselessly");} //our message for missing
} //end of fireRocket

Note that this is an object oriented example, ignore that if you aren't that advanced and just try to get an idea about the commenting I use. It's all about litterally spelling out what the braces are for. For some very short chunks of code it is fine to go ahead and put it all on one line and just put your comment on the same line at the end, below it or above it. I did some of both hoping you'd get the idea.



Cheers, Aaron Spears, general Partner - Valiant Galaxy Associates Developing "very good audiogames" for the blind community http://valiantGalaxy.com Sent with Thunderbird 38.5.0 portable
On 2/7/2016 5:07 AM, loriduncan wrote:
Hi thanks, it's just help getting started with bgt I'm looking for. I understand the first chapter, but when he gets into talking about bananas equals apples and so on, my brain just freezes and goes blank. :) My memory isn't too good where remembering symbles is concerned, so I'm trying to find an easy way to remember braces and so on.
Thanks from Lori.

-----Original Message----- From: Katie Epperson
Sent: Sunday, February 07, 2016 12:28 AM
To: Gamers Discussion list
Subject: Re: [Audyssey] Help with using bgt

I would be more than happy to help you

Sent from my iPhone

On Feb 6, 2016, at 5:35 PM, loriduncan <lori_dunca...@hotmail.com> wrote:

Hi everyone, I just re-downloaded bgt onto my new windows7 laptop, but am finding when I look in the program's folder I don't see any of the help documentation. I'm trying to learn BGT from the ground up again, as it's been ages since I've actually coded properly with it but what I don't want is to sit and listen to the audio manual again, as it just went in one ear and out the other without stoping to say hi to my brain. :) Also, if anyone has any tips on using bgt, I'd be very greatful. Thanks, from Lori.

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to