Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- int i = 0;
- while (i < Input.touchCount)
- {
- if(Input.GetTouch(i).phase == TouchPhase.Began)
- {
- RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position), -Vector2.up);
- if(hit.collider.tag == "panel" && GroundCheck.isGrounded)
- {
- jump = !jump;
- }
- }
- ++i;
- }
- }
- void FixedUpdate()
- {
- if(jump)
- {
- r.AddForce(Vector2.up * jumpSeed, ForceMode2D.Force);
- jump = !jump;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment