0
Im still a little confused on what char, float, double, and string would actualy be used for in a real game.
What are char, float, double, and string
4 odpowiedzi
+ 6
char: for keyboard key press detection or storage.
string: for gameobject's name or displaying text on the screen.
float and doubles: for position and velocity when you need smaller and more precise values. eg when you're trying to add acceleration (gravity in this case)
float acc=0.2;
float vel=0;
int y=0;
// every update tick
vel+=acc;
y+=vel;
+ 1
Thank you so much, that gave me a way better understanding on what they do because solo learn doesnt tell us that. Im guessing thats because not everyone is using
c++ for a video game.
+ 1
Char is datatype for a single character, can also be expressed in ASCII value
String is a sequence of chars, basically text.
You probably have played game with plenty of text.
float/double/int are datatypes for numbers.
With these 3 elements alone you can make a "real" game.
Use int to generate random numbers, get text input from user to guess it.
Make a GUI so the game looks better than your standard console app, design sprites or use blender to create 3D models, and use programing knowledge to give models "instructions" (all written in c++), define how much health the user has, define key strokes as movement, create maps etc... It's a long way of getting there, "real" games are in production by huge teams working crunch time and developing / improving code for months, sometimes years
0
Thank you guys for the answers. This really helped me. Now I have to get used using these statements in c++. I've only been doing c++ programming for 3 1/2 days and im already done with functions and the one after that. I am good at HTML coding and wanted to make games instead.