Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by ALittle12345 · Aug 09, 2015 at 04:36 PM · parsing error

I need help with a max.x parser error

using UnityEngine, using System.Collections;

public class PlayerControl : MonoBehaviour { // Use this for initialization void Start () { }

 // Update is called once per frame
 void Update () 
 {
 

 float x = Input.GetAxisRaw ("Horizontal");//the value will be -1, 0, or 1 (for left, no input, and right)
 float y = Input.GetAxisRaw ("Vertical");//the value will be -1, 0, or 1 (for down, no input, and up)
 
 //now based on the input we compute a direction vector, and we normalize it to get a unit vector
 Vector2 direction = new Vector2 (x, y).normalized;
 
 //now we call the function that computes and sets the player's position
     Move (direction);
 }

 void Move(Vector2 direction)
 {
   //Find the screen limits to the player's movement (left, right, top, and bottom edges of the screen)
     Vector2 min = Camera.main.ViewportToWorldPoint (new Vector2 (0, 0)); //this is the bottom-left point (corner) of the screen
 }   Vector2 max = Camera.main.ViewportToWorldPoint (new Vector2 (1, 1)); //this is the top-right point (corner) of the screen

}

    //Find how far the player sprite can go without going out
     max.x = max.x - 0.500f;//subtract the player's sprite half width
     min.x = min.x + 0.500f;//add the player's sprite half width
    
     max.y = max.y - 0.550f;//subtract the player's sprite half height
     min.y = min.y + 0.550f;//add the player's sprite half height

     //get the players current position
     Vector2 pos = transform.position;

     //Calculate the new position
     pos += Direction * speed * Time.deltaTime;

     //Make sure the new position is not outside the screen
     pos.x = Mathf.Clamp (pos.x, min.x, max.x); 
     pos.y = Mathf.Clamp (pos.y, min.y, max.y);
     
     //Update the player's position
     transform.position = pos
    } 
   
 }

}


Hello I have no I de how to ask or fix this can anybody help?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by allenallenallen · Aug 09, 2015 at 04:37 PM

Here, I took a screenshot of your code and circled the extra curly brackets in red. Delete them.

alt text

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ALittle12345 · Aug 09, 2015 at 04:49 PM 0
Share

Thank you," but now it says end of file" problem (CS1525 )

avatar image allenallenallen · Aug 09, 2015 at 04:51 PM 1
Share

Always make sure there are an even number of brackets. I only told you to delete the brackets based on what you showed me. You might have other codes that you didn't fully copy. So go check if there are even number of brackets and that you're ending the whole script with a closed curly bracket.

avatar image ALittle12345 · Aug 09, 2015 at 05:34 PM 0
Share

what about a end-of-file error?

avatar image ALittle12345 · Aug 09, 2015 at 05:58 PM 0
Share

I fixed the first 2 but know it has a problem with the speed time deltaTime

avatar image allenallenallen · Aug 10, 2015 at 03:25 AM 1
Share

What I said. Curly brackets. $$anonymous$$ake sure there's one } at the end of the script. And make sure there are an even number of them.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Shader Compile Error, Parsing 1 Answer

Error CS8025 1 Answer

Strange Parsing Error 1 Answer

Parsing error -.- 2 Answers

Unexpected "{" and parsing error (roll a ball tutorial) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges