- Home /
changing floats by input C#
i'm a complete novice to C#... on the 'mouselook' script how can i (by the input "Scope") no increase sensitivityX and sensitivityY to a different nunber then when the button's not pressed it be another number... mouselook is in C sharp, all i know is java! any help apprechiated thanks!
Answer by Berenger · Feb 07, 2012 at 08:40 PM
You'll need 4 variables instead of 2, unless you want a simple ratio (x2 for instance). Then, use the appropriate one if the button is pressed or not. There isn't much difference with javascript here, so you should be ok by looking how the other variables are declared.
PS : I love your pseudo :p
thanks... you're right it is very similar to js... i never realised. i added these variables:
public float sensitivityBackX = 15F;
public float sensitivityBackY = 15F;
public float ChangeX = 15F;
public float ChangeY = 15F;
and changed them with this:
if(Input.GetButton("Scope")){
sensitivityX = ChangeX;
sensitivityY = ChangeY;
}
if(Input.GetButtonUp("Scope")){
sensitivityX = sensitivityBackX;
sensitivityY = sensitivityBackY;
}
almost identical to js that bit! haha
PS: i know it's my ps3 name as well haha :D
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Checking if the Mouse Has a Middle Button 1 Answer
Click to move issue. 2 Answers