Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
avatar image
0
Question by Najrax · Oct 12, 2010 at 07:59 AM · gamemovingcoordinatestilespuzzle

Having a player object move on coordinates

Since a few weeks I have been working on a simple tile based puzzle game in unity, I wanted to ask if someone on here might know how to help me out with a problem we have. The game needs to have a player that can jump from tile to tile so I think we need to put movement trough coordinates since we only want it to be able to jump one tile each time. The meaning of the game is to put all tiles in a certain pattern to clear the level, I hope someone can help out with this problem. alt text

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
2

Answer by Jesse Anders · Oct 12, 2010 at 10:59 AM

Presumably you have the positions of all the tiles available (e.g. stored in a 2-d array). At any one time, the player is associated with one of the tiles, which specifies the player's current position. In response to input events (buttons/keypresses/etc.), the player can jump to a neighboring tile. The indices of the new tile can easily be determined from the indices of the current tile; once new tile indices have been assigned to the player, the player's new position can be determined as well.

Functionally, a good place to start might be (if you haven't done this already) simply to move the player instantaneously from one tile to another. The rest is really just polish; that said, it's probably the polish that will take the majority of the time.

The first thing you can do to smooth things out a bit is to interpolate to the new position over a short period of time rather than just 'teleporting' instantly. Eventually you'll likely also want to play some sort of 'jumping' animation. And so on.

Does that help at all? Or is there something more specific that you're looking for?

Comment
Add comment · Show 2 · 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 Najrax · Oct 12, 2010 at 10:12 PM 0
Share

This does describe what I am looking you yes, the problem is my scripting issn't really that good, so to tell the truth I have no idea how to start working on what you just explained. If you have the time to look into it that would be great, but even if you don't you already gave me some good info and I am grateful for that.

Thanks

avatar image Jesse Anders · Oct 12, 2010 at 10:59 PM 0
Share

I'd start with the simplest implementation possible; that is, 'teleporting' the player instantly from tile to tile. Take a look at Input.GetButtonDown(), Get$$anonymous$$eyDown(), and/or GetAxis() for movement. For setting the player's position, look at Transform.position. You'll also most likely want a 2-d array (in one form or another) that stores the tiles and/or tile positions. If you run into problems from there, I'd recommend posting whatever code you have in a new thread along with your questions. (Note that for those sorts of questions, you might have better luck in the forums.) Hope that helps :)

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

No one has followed this question yet.

Related Questions

Water Flowing in pipes 0 Answers

Cube Rotating & Moving 1 Answer

Puzzle logic stuck 2 Answers

Moving object on plane 1 Answer

tilemap tiles broken 0 Answers


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