Re: Shooter XT - Open sourced 2D Sidescroller Shooter for BGT beginners

Tunmi, I quite honestly fail to see how you consider this organized, and in places I do not understand what your code is doing, or rather why it is doing what it is doing. For example.

p.update_listener_2d(x,y);
p2.update_listener_2d(x,y);

Why have two sound pools when this isn't a big game that requires playing that many sounds at once? And furthermore, why update the positions, of both...
Nextly, for loops *do NOT* create arrays. The simply loop threw elements of them, or can if you tell them to. Only for each loops can loop threw arrays by default, or Python and Rust for loops. None of those can *create* arrays. You create the array when you have bullet@[] bullets(0);
Next up, comments. I personally only comment my code if it's open sourced, or viewed by others. Well that's false. But I don't heavy comment like most open source projects. And this...

void readdata() 
//This is a function that reads the saved data.
{
sd.load(); //This loads the dictionary. We now have to check if values exist. And if they do, then make the values in the game equal to that of the saved values. Like so.
if(sd.d.exists("kills")) kills=sd.readn("kills");
/* Let's break this down for you to better understand.
if(sd.d.exists("kills"))
This means that it is checking our class instance, labeled sd.
Then it is checking the dictionary within the class, labeled d.

Finally it is checking for the value labeled "kills".
If the value exists, it is saying, hey. Read this. Now make the kills value, equal this. Like so.
kills(game value)=sd.readn("kills"(dictionary value))
Now same for the deaths.
*/
if(sd.d.exists("deaths")) deaths=sd.readn("deaths");
}
//Now we have to make a function to add these settings/values to the dictionary. Let's make a new function called adddata.
void adddata()
{
//Now let's add both kills and deaths values to the dictionary. You will notice that one is the value name, and then one is the value data. Like so.
sd.add("kills",kills);
sd.add("deaths",deaths);
/*
The kills and deaths in quotes are the name. This is what the readdata is checking for. When we are saying if(sd.d.exists("deaths")) or sd.d.exists("kills")) this is what it is expecting to find, because we added these values.
The kills and deaths that aren't within the quotes is what is being read. This applies to the kills=sd.readn("kills"); or deaths=sd.readn("deaths");
Now lets save this data as not to lose it.
*/
sd.save();
}

This, at least to me, gives off that vibe of, "Hi, I'm the BGT tutorial!" In edition, this bullet class seems to have been stolen from SB.
Next up, why make a long comment explaining how to use m_pro if you didn't make it yourself?

void setupmenu(bool add_music=true)
{
/*
Now what on earth is that you might be wondering? This is a setup menu function. It gets the menu prepared so we don't have to do it every single time we make a new menu.
The bool add_music=true within the function's parentheses, is a bool specifying whether the menu should contain music or not. If it is false the menu will remain silent. But since I like menus with music I've made the default parameter true.
Now lets add a few parameters to the menu. We do this by calling up our dynamic_menu_pro m class instance, like so. 
m.class_parameter
For example:
*/
m.enable_up_and_down=true; //This enables the use of the up and down arrow keys.
m.enable_left_and_right=true; //This enables the use of the left and right arrow keys.
m.click_sound="menuclick.ogg"; //This is the sound that plays when the user cycles through the menu using the arrow keys.
m.enter_sound="menuenter.ogg"; //This is the sound that playes when the user clicks the Enter key.
m.wrap=true; //This configures whether the menu wraps to the top or bottom when the user cycles to the first or last item, or if it simply bumps against the menu border. Since it is true, the menu will simply wrap if you go off the boundary.
if(add_music==true) //This is an if statement checking the add music bool and whether it is true. And if it is, it returns a string containing the music file name.
{
m.add_music("menumusic.ogg");
}
else if(add_music==false) //This is an if statement, but this time checking if the add_music bool is false. if so it returns a blank string.
{
m.add_music("");
}
}

And your main function.

void main()
{
//Let's show the game's window. We do it just like this.
show_game_window("Shooter Extreme"); //Now the user will be able to find the window when they Alt Tab or Alt Shift Tab.
//Now lets load our sounds and set the sound storage. If we don't do this we'll get a blank game.
set_sound_storage("sounds.dat");
//Now lets load the ambience.
amb.load("amb.ogg");
//Now set its volume.
amb.volume=-10;
readdata(); //This reads the data by opening the function that we created above.
menu(); //Opens the main menu.
}

This, in my opinion, is way the fuck to commented. Anyone who has read the BGT tutorials will know  what most of that does. This circles back to my point about you trying to make this a BGT tutorial.
Don't get me wrong, I like and respect what you're trying to do here. But I honestly think this code would be better to teach people what *not* to do. Plus the stolen bullet class...
Feel free to take all this with a grain or 50 of sault, but that's all I currently have to say on the matter.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — New releases room : TheTrueSwampGamer via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Jaidon Of the Caribbean via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : tunmi13 via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : TheTrueSwampGamer via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Simter via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — New releases room : Lucas1853 via Audiogames-reflector

Reply via email to