Hey guys…
Quick question: Is it possible to define a relatin between 2 variables, so that .e.g when
one of the variables is added by an amount of 10, the other is added by 20 automatically?
If so, how do you do it?
Hey guys…
Quick question: Is it possible to define a relatin between 2 variables, so that .e.g when
one of the variables is added by an amount of 10, the other is added by 20 automatically?
If so, how do you do it?
It is possible but you’d have to be more specific.
Post example code if you have any.
like
var One : float = 5;
var Two : float = 0 ;
function Update () {
Two = One * 2;
}
Two would equal 10
Would’t this multiply one by 2 ever frame? In that case it would increase exponentially, and at some point crash the system. xD
Unless you of course stopped it at some point.
What I had in mind was, a door opening script, to make doors wirk like in Amnesia. So that when you klick a door, and move the mouse, the door wil rorate in relation to the mouse movement. In this way, the door doesn’t only have an ‘open’ and ‘closed’ state, but will be totally manipulable.
Thanks for your answer. ![]()
you could write a function and put both lines of code into the function. Then you only need to call the function to do it.
EG
function addStuff(amt : int)
{
var1 += amt;
var2 -=amt*2;
}
then jut call the function (obviously declare the variables lol)
Right,
So next question, is there any way to read the Y-value of the mouse’s position on the screen?
Input.mousePosition.y
I am being vague on purpose by just linking to the input object’s scripting reference page. This is so you look through it a little. The scripting reference is a great place to look for things, and after a bit of looking through it and learning a few core commands like Input, Transform, etc, you will start to be able to figure stuff out on your own a little more.
We are here to help out, so if you have any more questions, keep asking. All I ask is that you look through the scripting reference a little to get use to some of the commands. There is a lot of stuff in there, so don’t worry to much about asking for help. ![]()