# Is This Right(Part II.)

**URL:** <https://forum.kirupa.com/t/is-this-right-part-ii/63910>\
**Category:** programming\
**Created:** [September 11, 2004, 5:21am UTC](https://forum.kirupa.com/t/is-this-right-part-ii/63910 "2004-09-11T05:21:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enix591](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/enix591/32/751_2.png) [@Enix591](https://forum.kirupa.com/u/Enix591)\
**Post date:** [September 11, 2004, 5:21am UTC](https://forum.kirupa.com/t/is-this-right-part-ii/63910/1 "2004-09-11T05:21:26Z")

</div>

Ok I need sombody to check this code,on my game im try to make my character(“Sonic”) face in different directions(Left And Right), and also control whether or not there walking,running or dashing. I used absolute value to measure the distance from zero(the speed), and whether or not my character was facing right to show which way im facing.

> 

if (\_root.Sonic.Xspeed == 0) {  
if (\_root.Sonic.Right == true) {  
\_root.Sonic.gotoAndStop(“Stand Right”);  
} else if (\_root.Sonic.Right=false) {  
\_root.Sonic.gotoAndStop(“Stand Left”);  
}  
} else if (not (\_root.Sonic.Xspeed == 0)) {  
if (\_root.Sonic.Right == true) {  
} else if (Math.abs(\_root.Sonic.Xspeed)\<=10) {  
\_root.Sonic.gotoAndStop(“Walk Right”);  
} else if (Math.abs(\_root.Sonic.Xspeed)\<=20) {  
\_root.Sonic.gotoAndStop(“Run Right”);  
} else if (Math.abs(\_root.Sonic.Xspeed)\<=30) {  
\_root.Sonic.gotoAndStop(“Dash Right”);  
}  
} else if (\_root.Sonic.Right == false) {  
if (Math.abs(\_root.Sonic.Xspeed)\<=10) {  
\_root.Sonic.gotoAndStop(“Walk Left”);  
} else if (Math.abs(\_root.Sonic.Xspeed)\<=20) {  
\_root.Sonic.gotoAndStop(“Run Left”);  
} else if (Math.abs(\_root.Sonic.Xspeed)\<=30) {  
\_root.Sonic.gotoAndStop(“Dash Left”);  
}  
}
