In a mario game I am programming, I cant get the koopa to stop moving after mario jumps on him. My code for his movement is below:
onClipEvent (enterFrame) {
if (this._xscale == 100) {
this._x -= 1;
}
if (this._xscale == -100) {
this._x += 1;
}
}
             
            
              
              
              
            
            
           
          
            
              
                system
                
              
              
                  
                  
              2
              
             
            
              give the kupa a boolean variable that changes to true when mario jumps on him and then adjust your code slightly:
onClipEvent (enterFrame) {
if(!this.flattened) {
if (this._xscale == 100) {
this._x -= 1;
}
if (this._xscale == -100) {
this._x += 1;
}
}
}
Hope that helps.
             
            
              
              
              
            
            
           
          
            
              
                system
                
              
              
                  
                  
              4
              
             
            
              SWEET! it worked! Thanks, Dude!
             
            
              
              
              
            
            
           
          
            
              
                system
                
              
              
                  
                  
              5
              
             
            
              Another note, you can replace
this._x -= 1;
and
this._x += 1;
With
this._x++
and
this._x–