init
This commit is contained in:
		
						commit
						a8c6025cd3
					
				
					 158 changed files with 86052 additions and 0 deletions
				
			
		
							
								
								
									
										29
									
								
								Assets/Scripts/LimitedJumps.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Assets/Scripts/LimitedJumps.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| 
 | ||||
| public class LimitedJumps : MonoBehaviour{ | ||||
| 
 | ||||
|     public bool jump; | ||||
|     public bool doubleJump; | ||||
|     public bool grounded; | ||||
| 
 | ||||
|     Rigidbody2D rb2d; | ||||
| 
 | ||||
|     // Start is called before the first frame update | ||||
|     void Start(){ | ||||
|         rb2d = GetComponent<Rigidbody2D>(); | ||||
|     } | ||||
| 
 | ||||
|     // Update is called once per frame | ||||
|     void Update(){ | ||||
|         if (grounded){ | ||||
|             jump = true; | ||||
|             doubleJump = true; | ||||
|         } | ||||
|         else if (doubleJump){ | ||||
|             jump = true; | ||||
|             doubleJump = false; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gerard Gascón
						Gerard Gascón