Cruba’s B.urg Z.erg A.rcade H.ack A.nd S.lash T.utorial S.eries Guide
Hack And Slash Tutorials by Peter Laliberte: burgzergarcade.com
This one is just for people who are not knowing MonoDevelop and are completely amateurs in programming, coding, MonoDevelop.
When you start Burg Zerg Arcade Hack And Slash Tutorial Series, you will use MonoDevelop for coding the C# scripts.
*** Tips ***
1) Saving in MonoDevelop – undo/redo
Saving does not delete the stored undo and redo queue like in other programms. Keep that in mind, because it’s a really cool feature.
2) Search in files
You could search a phrase in your whole solution over
top menu -> search in files
3) Rename variables in all files
You could right click a variable and do Refactor -> Rename. It will rename the variable in any position in any file. Warning: If you want to change 2 variables names, don’t rename one to same name than the other and refactor then. You will just get anything renamed in one.
Example:
public float minHeight = 8f;
public float maxHeight = 12f;
minHeight and maxHeight MonoDevelop just make the difference by name. So if you want to rename maxHeight to minHeight and minHeight to whatever, you must refactor(rename) minHeight first, because MonoDevelop will not make another difference than by name.
4) Comment out more than one line without //
/* <<– starts commenting out
disabledcode
disabledcode
disabledcode
disabledcode
disabledcode
*/ <<–ends commenting out
5) Tab multiple codelines left or right for better overview
Mark all codelines and hit tab key to move code to the right:
code to move ->
code to move ->
code to move ->
code to move ->
code to move ->
Mark all codelines and Hold down Shift, hit Tab to move code to the left.
<- code to move
<- code to move
<- code to move
<- code to move
<- code to move
6) Defining regions for much better overview
You could define zones easily to shrink code to a single info line.
#region Here is a coderegion
code
code
code
code
code
#endregion
Klick – to minimize that region and it looks like this:
+ Here is a coderegion …
7) Mark codelines to have overview in bigger scripts
You could mark any codeline in any script. Useful whan more than one script is discussed not to lose tha overview. Just click in the plain field at the beginning of a line – you will get a red dot and line marked red.
Use it to mark codelines fast, to prevent forgetting something or to make it easier to find special lines in different scripts again. MonoDevelop saves the markings individual for any script.

*** Traps ***
1) The default color theme has a visual problem with _ followed by //
Comments behind codelines make underscores _ invisible. It is just invisible. It is still active and does not make errors. Example:
private Color[] _defaultColors; <<– visible _
private Color[] defaultColors; // here is my comment <<– invisivble _
To fix this visual problem go to top menubar of MonoDevelop:
Tools -> Options -> Syntax Highligting
Any other theme expect “Default” should be ok. The theme used in the video tutorial series is “GEdit – GEdit like style”.
*** Popular Errors ***
A list of errors and wrong typeing I also did and sometimes will drive you crazy. MonoDevelop don’t use bold writing, so I will do it to make the errors more visible for you:
Codeword instead of codeWord
(watch out case sensitivity)
codeWord instead of _codeWord
(forgot prefix/underscore _. Petey use it to sign private variables)
missing semicolon at the end of lines;
(don’t forget semicolon at the end of lines if needed)
The big problem with forgetting semicolon is: You don’t get an error message for the line where the semicolon is missing, you get it much much later and don’t really know what you did wrong, because the line MonoDevelop tells you is definately correct and you will get crazy for hours maybe. Example:
public static string[] femaleModels = { ” Female A”, ” Female B” } <<–
you forgot the semicolon here at the end (line 1!)
// public static PlayerCharacter pc;
// index 0 = mainmenu
// index 1 = character creation screen
// index 2 = character customization screen
// index 3 = tutorial level
public static string[] levelNames = { <<–
error message 9 lines later but the codeline is correct!
forgot the last / in paths
public const string PATH = “Character/Model/Prefab/Human/Male”; <<– wrong
public const string PATH = “Character/Model/Prefab/Human/Male/”; <<– correct
***More popular typos***
: instead of ;
; instead of :
() instead of []
[] instead of ()
< instead of >
> instead of <
0 instead of null
= instead of ==
case; instead of case:
(case is the only one I know since I started that need colon instead of semicolon)
forgot <>
instance = go.GetComponentPC(); <<– wrong
instance = go.GetComponent<PC>(); <<– correct
(if you forget something like this you could get much errors)
Last word in lists – no comma! Example:
public enum State {
Idle,
Init,
Setup,
Run <<– no , !
}
That’s it…