Good morning people
Im going to try and explain what I’m trying to do, the short version (and in the best english, sorry for spelling mistakes etc.)
Assignment: Making a valve turn around by using the mouse, and thereby making a meter on another movieclip turn. The speed of the meter changes if you open the valve further.
Problem: The valve shouldnt be able to turn anymore after he’s completed a complete circle (360) or rather a bit less. Also the meter is starting te deplete (go left again) after i hit 180 degrees. Now I’ve traced the rotation of the valve its starts going in the negative after i reach 180. So I know the problem is to be found there just cant seem to solve it.
Thanks!
Here is my code:
//---------------------------------------------------ZUURSTOF_INITS----------------------------------------------//
var valveOpen:Boolean = false;
//---------------------------------------------------ZUURSTOF_FUNCTION-------------------------------------------//
valve_mc.onPress = function() {
indrukken = true;
valveOpen=true;
};
valve_mc.onRelease = valve_mc.onReleaseOutside = function() {
indrukken = false;
};
_root.onEnterFrame = function() {
if(valveOpen){
meter_mc.arrow_mc._rotation += (valve_mc._rotation/50);
output_txt.text = Math.floor(meter_mc.arrow_mc._rotation);
}
rad = Math.atan2((_root._ymouse-valve_mc._y), (_root._xmouse-valve_mc._x));
graden = Math.round(rad*180/Math.PI);
if (indrukken == true) {
valve_mc._rotation = graden+180;
}
}