Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Ekta-Mehta-D · Jul 15, 2014 at 05:27 AM · gridlogicgrid based gamestrategy

Grid System (Unblock me) Unity3d

Hello everybody..

I am making "Unblock me" type of game. video : http://www.youtube.com/watch?v=2GQj6_J1Mxk I stuck at generation of grid system. As here cubes are moving in grid horizontally and vertically..

as well as cubes will be unit of 2-3 blocks of the grid. So stuck at making of such type of grid in whick i can make track of each block based on that cubes are allowed to move .

So please help me to make this system..

And if i am going to wrong track then also let me know.

Thanks all of you for your help and support in advance..

Comment
Add comment · Show 2
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 robertbu · Jul 16, 2014 at 02:28 PM 2
Share

You really have a design discussion question at this point. There are many different way to approach this problem, and there are multiple issues here. Typically we suggest you ask a question on Unity Forums, but this is so nebulous that I think you would have a problem getting an answer there as well. Let me suggest how I might approach this problem. Note this just my ideas and another programmer might approach the problem differently (that is what makes it a design/discussion question):

  • I'd create my grid world on screen using units. That is, if you consider each block made up of two or more squares, I'd make each square 1 unit a side.

  • When not dragging, I'd have the center point of each square of each block be on a unit grid position (like (1,1) or (3,4)).

  • I would create a 2D array that indicates what positions are occupied. An array of boolean values would work, but I'd likely make it an array of references to blocks.

  • I would oversize the array by two rows and two columns. That is, if your game was 6 x 6 like Unblock $$anonymous$$e, the array would be 8 x 8. This would allow me to set the condition of the outside boundary. I would set all but one position around the edge as being occupied. The one not set would be the exit/goal. The use of these extra rows and columns would eli$$anonymous$$ate boundary conditions with my drag and drop code.

  • I'd likely align the array with my physical world. That is if you were creating a 6 x 6 game, the array would be 8 x 8 running from 0 to 7 in each dimension. The 0 and 7 rows/columns are the edges, so the grid point in the physical world would be 1 to 6 running from (1,1) in the lower left corner to (6,6) in the upper right.

With this setup, it is easy to snap squares to the grid when I release them from dragging (I'd only need to round the x,y position). It is also easy to map a squares central position to an entry in the 2D array. I could use $$anonymous$$athf.RoundToInt() for both x and y to give me back the indices into the array. This mapping is what allows me to limit the blocks movement.

avatar image Ekta-Mehta-D · Jul 18, 2014 at 12:09 PM 0
Share

Thank you sir.. @robertbu

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mastermindgame · Sep 18, 2014 at 06:30 PM

Asset Available :

http://u3d.as/content/master-mind-game/unblock-me-with-game-ai-solution-/9dP

Comment
Add comment · 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

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

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Issues with manual collision detection involving updates... 1 Answer

Code for gridColour[x,y] == gridColour[x+1,y] || colour at [x-1,y] || colour at [x,y+1] ||colour at [x, y-1] to detect if 4 of the same colours are connected? 0 Answers

Grid snapping 0 Answers

Update Hex Grid Cell After Shooting 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