OK Let's get cracking (cracks Fingers while eating loaf of bread) in the second program... well i can't really say much about any of these programs until something is done about the first or introduction... how else will i be able to make sense of out the rest of the programs here and begin critizing them seeing as how you "supposedly made everything understandable in the intro and first... ok well ill try:
void autoexec()
{
SetAppName("Sliding Hello World");
// Give the program a name in the title bar - just to be nice
int x = ImageWidth(screen) / 2;
int y = ImageHeight(screen) / 2;
// This time we are use two variables to store where on the screen the text is put
// They are starting in the middle of the screen, using the same method as before
while (!b3) // If escape is not pressed
{
// Now we are going to check the arrow keys (or gamepad directionals) one at a time
// Then move the text around if a button is pressed at the last ShowPage() call
// We check up OR down then separately left OR right
// So the text will move diagonally if two nonconflicting buttons held down together
// We modify the x and y variables according to the button presses, moving the text
if (up) // If up arrow is pressed
{
y -= 1; // Decrease y coordinate
}
else if (down) // If down arrow is pressed
{
y += 1; // Increase y coordinate
}
if (left) // If left arrow is pressed
{
x -= 1; // Decrease x coordinate
}
else if (right) // If right arrow is pressed
{
x += 1; // Increase x coordinate
}
RectFill(0, 0, ImageWidth(screen), ImageHeight(screen), 0, screen);
// Reset the screen buffer to plain black
PrintCenter(x, y, screen, 0, "Hello World!");
// Prints said text centered from coordinates x, y
ShowPage(); // Displays the buffer on the screen
}
Exit("Bye!");
}
Here (assuming you made some sense of the first program and the intro) you will have the player ponder about the x and y coordinates... and you also have the new programer wonder what the hell are some many coordinate words placed on there and the pressed word? "Hunh?" "y -= 1; // Decrease y" this can pretty confusing to the noob verger. For me it looks like variables and to someone else it might look like letters with some mumbo jumbo slashes added with a dash and equal sign. Remember if you are trying to make some sense into noobs you have to be the noob yourself. Think "if i was a noob would i understand it?" Think back to your first few days of being on Verge annd ask yourself "on my first day would i really understand all of this crap?"
On to the THIRD!!!
void autoexec()
{
SetAppName("Stepping Hello World");
int x = ImageWidth(screen) / 2;
int y = ImageHeight(screen) / 2;
// Setting the same variables as before to center coords
while (!b3) // If escape is not pressed
{
// We use the same basic format for checking inputs
// But this time manually 'unpress' the buttons each time
// As it relies on discrete button presses, we move by a larger amount
if (up) // If up arrow is pressed
{
y -= 10; // Decrease y coordinate
Unpress(5); // Turn off up button
}
else if (down) // If down arrow is pressed
{
y += 10; // Increase y coordinate
Unpress(6); // Turn off down button
}
if (left) // If left arrow is pressed
{
x -= 10; // Decrease x coordinate
Unpress(7); // Turn off left button
}
else if (right) // If right arrow is pressed
{
x += 10; // Increase x coordinate
Unpress(8); // Turn off right button
}
// Reset the screen buffer to plain black
RectFill(0, 0, ImageWidth(screen), ImageHeight(screen), 0, screen);
// Prints said text centered from coordinates x, y
PrintCenter(x, y, screen, 0, "Hello World!");
ShowPage(); // Displays the buffer on the screen
}
exit("Bye!");
Well im going to be simple here and just do what you did to the second program it looks the same but if there are areas which you haven't touched upon or feel you haven't touched upon than go ahead and divluge into more detail.
To The FORUTH!!!
int x = ImageWidth(screen) / 2; // Sets variable x to middle of screen
int y = ImageHeight(screen) / 2; // Sets variable y to middle of screen
// Because we need to use the x and y outside the autoexec function in this program
// They need to be made global variables - so outside all functions and accessible to all
// It is generally thought good practice to avoid having too many global variables
void autoexec()
{
SetAppName("Stamping Hello World");
// This time we set a specific function for each of the four directionals before the loop
// This means whenever on of the keys is pressed, it will call the set function
// Notice we are using keyboard keys here, rather than generic buttons
HookKey(SCAN_UP, "KeyDown_Up");
HookKey(SCAN_DOWN, "KeyDown_Down");
HookKey(SCAN_LEFT, "KeyDown_Left");
HookKey(SCAN_RIGHT, "KeyDown_Right");
while (!b3) // If escape is not pressed
{
// Reset the screen buffer to plain black
RectFill(0, 0, ImageWidth(screen), ImageHeight(screen), 0, screen);
// Prints said text centered from coordinates x, y
PrintCenter(x, y, screen, 0, "Hello World!");
ShowPage(); // Displays the buffer on the screen
}
Exit("Bye!");
}
// These functions are called once and only once when the specified key is pressed
void KeyDown_Up() // Runs when up arrow is pressed
{
y -= 10; // Decrease y coordinate
}
void KeyDown_Down() // Runs when down arrow is pressed
{
y += 10; // Increase y coordinate
}
void KeyDown_Left() // Runs when left arrow is pressed
{
x -= 10; // Decrease x coordinate
}
void KeyDown_Right() // Runs when right arrow is pressed
{
x += 10; // Increase x coordinate
}
Let's see here... there seems to be a lot of code in there so it would be much more simple and understandable if you were to break it up into parts. Once again use the same strategy i suggested into the third program... go into detail about the hookkey thing seeing as how i did not see it in the third program. So just follow this suggestion and you will be fine. Next up 5- Outroduction. Unless you already edit the 1-2 programs than i will return to critisize them! YAY!
(added pre-tags. -Grue)