The same action but in 4 different languages. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The same action but in 4 different languages.

What would the code look like in the following languages: C, C++, C# And Java, if a person when the R key has been pressed, the weapon they are holding reloads?

9th Mar 2019, 12:11 PM
IDGam3r
IDGam3r - avatar
1 Answer
+ 1
C#: private static void onKeyDown(......) { if (e.KeyCode == KeyCode.R) { thePlayerClass.theWeapon.reload(); } } Im assuming you know how handling events work, and also that you have a player class containing the weapon the player holds, and also that the weapon has a reload method.
16th Mar 2019, 7:51 PM
inxanedev!
inxanedev! - avatar