Discuss Scratch
- Discussion Forums
 - » Help with Scripts
 - » [MIGHT BE A GLITCH] Slope detection not working
        
         
- jromagnoli
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
[MIGHT BE A GLITCH] Slope detection not working
I'm having trouble with slope detection in a scrolling platformer script. I based this off of Griffpatch's tutorial, but am adding a few features and tweaking other features.

This script should theoretically incrementally move the player up sx * slope times (in this case sx=8 and slope=2) and then, if it still is stuck, move it back down sx * slope times.
For some reason it isn't working and I have no idea why. It's causing a tonne of other bugs in the project as well. If I manually input
Just in case this matters, the position block updates the position of the player and the if clause merely exits the custom block when the parameters have been achieved.
                        
                        
                    
This script should theoretically incrementally move the player up sx * slope times (in this case sx=8 and slope=2) and then, if it still is stuck, move it back down sx * slope times.
For some reason it isn't working and I have no idea why. It's causing a tonne of other bugs in the project as well. If I manually input
repeat (16)and
end
change [y v] by (-16)Then it suddenly works perfectly. Unfortunately, this ruins the modularity of the system.
Just in case this matters, the position block updates the position of the player and the if clause merely exits the custom block when the parameters have been achieved.
- deck26
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
[MIGHT BE A GLITCH] Slope detection not working
Best to share the project rather than one script.
                        
                        
                    - Discussion Forums
 - » Help with Scripts
 - 
            » [MIGHT BE A GLITCH] Slope detection not working 
         
            
