How do i rearrange this in C(sharp)?

Hello

I was wondering if someone could help me well basically how do covert this into C(sharp)

     if(Input.GetKey(KeyCode.F) && BulletsLeft ){

not all of the line just the && because i get an error message but in java this works fine

please can someone help me thank you in advance MCHALO

1 Answer

1

You can’t get an error message cuz there is no error there just make sure that (BulletsLeft) is exist in ur C# Script

I have :) its called public int BulletsLeft = 0; on my script and i get this error : Assets/FPSScripts/C(Sharp)/RayShootC.cs(68,34): error CS0019: Operator &&' cannot be applied to operands of type bool' and `int' :)

yes you can't do this because (BulletsLeft) is int and u need to make something like this if(Input.GetKey(KeyCode.F) && BulletsLeft == 0 ){

yep that solved it i need to do that but the equal had to be > because if i did 0 then i could only fire if my bullets went to 0 thank you :)

Ugh yeah , you welcome :)

: ) lol thanks once again :)