How to use functions in Jmeter?

Where do we use arrays, functions and classes in video games? (Python)

  • I am using python + pygame for game development. I am still learning the basics. the first question I always ask (because I am impatient with programming) Where do you use this concept in games? :P I have read about arrays, functions and classes. Where do you use them in games? I wonder where arrays are used in games? do we used them for example in weapon ammo? rather than creating 100 bullet variables you create one weapon magazine array and insert 100 values? For functions we can use it for player jump calculate arch for the jump or attack damage based on distance? Aside from classes being used for different kinds of enemies with different variations what else are they used in oop for games? I appreciate good examples in advance :)

  • Answer:

    Literally everywhere. Arrays, classes, and functions are fundamental to object oriented programming which is fundamental to game programming, if you're using an object oriented approach. An extremely simple design for a game might have an overarching"game state" class with an array of objects of class "entity." Every entity might have an integer to represent the number of bullets in its clip, a set of images containing its animations, and so on. When a button was pressed by the user, a function would be called in the game state class updating the game state. When the game needed to draw the game state to the screen, another function would be called. So if your question is "do I need to learn all this," then the answer is yes, you must know every single concept on that list, without exception, if you want to make games.

Benjamin Pious at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.