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 FarisGames · Feb 07, 2014 at 10:40 AM · javascriptgame editoreditor extention

Making a tile editor

Hello everyone!

i'm wondering about how do you make a tile editor. i've stumbled on a plugin in the Assets store. and i wanna develop my own, to use in the game. it's better than paying 25$

http://u3d.as/content/doppler-interactive/tidy-tile-mapper/2AF http://www.youtube.com/watch?v=Oh1AH9N1-9E

Thanks!

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 ashique · Feb 07, 2014 at 11:18 AM

Hi I have created one Tile manager as given below, you can edit it depending upon your requirement..

using UnityEngine; using System.Collections;

// This class will provide tiles position, status, type public class TilesManager : MonoBehaviour
{ float mfXRatio; float mfYRatio;

 public int _iNoOfRows;
 public int _iNoOfCols;
 
 public float _LeftMargin;
 public float _DownMargin;
 public float _XSpace;
 public float _YSpace;
 
 Vector3 [,]_VectDotsPosition;
 
 public static TilesManager _tilesManager;
 TileType[,] meTilesType;
 // Use this for initialization
 void Start () 
 {
     _tilesManager = this;
     mfXRatio = Screen.width/768f;
     mfYRatio = Screen.height/1024f;
     
     createTiles(_iNoOfRows, _iNoOfCols, _LeftMargin, _DownMargin, _XSpace, _YSpace);
 }
 
 
 
 // To create Tiles
 public void createTiles(int piNoOfRows, int piNoOfCols, float pfLeftMargin, float pfDownMargin, float pfXSpace, float pfYSpace)
 {
     
     _VectDotsPosition = new Vector3[piNoOfRows, piNoOfCols];
     InitializeTileType();
     for(int i = 0; i < piNoOfRows; i++)
     {
         for(int j = 0; j < piNoOfCols; j++)
         {
             _VectDotsPosition[i,j] = new Vector3((pfLeftMargin + pfXSpace * i) * mfXRatio, (pfDownMargin + pfYSpace * j) * mfYRatio, 0);
         }
     }
 }
 
 void InitializeTileType()
 {
     meTilesType = new TileType[_iNoOfRows, _iNoOfCols];
     for(int i = 0; i < _iNoOfRows; i++)
     {
         for(int j = 0; j < _iNoOfCols; j++)
         {
             meTilesType[i, j] = TileType.BREAKABLE_TILE;
         }
     }
     

// meTilesType[3, 6] = TileType.UNBREAKABLE_TILE; // meTilesType[0, 6] = TileType.EMPTY_TILE; // meTilesType[7, 7] = TileType.EMPTY_TILE; // meTilesType[4, 3] = TileType.UNBREAKABLE_TILE; // meTilesType[4, 2] = TileType.UNBREAKABLE_TILE; }

 // Returns tile position
 public Vector3 GetTilePosition(int piIndexX, int piIndexY)
 {
     if(piIndexX >= _iNoOfCols || piIndexX < 0 || piIndexY >= _iNoOfRows || piIndexY < 0)
         return Vector3.zero;
     return _VectDotsPosition[piIndexX, piIndexY];
 }
 
 public void SetTileType(int piIndexX, int piIndexY, TileType peType)
 {
     meTilesType[piIndexX, piIndexY] = peType;
 }
 public TileType GetTileType(int piIndexX, int piIndexY)
 {
     return meTilesType[piIndexX, piIndexY];
 }

}

public enum TileType { BREAKABLE_TILE, // A dot can move to this tile UNBREAKABLE_TILE, // A dot cant move to this tile, the dot will pass through beside tiles EMPTY_TILE, // A dot will pass through this tile if next to this empty tile is breakable BLOCKED_TILE, BLOCKED_TILE_TYPE1, BLOCKED_TILE_TYPE2, BLOCKED_TILE_TYPE3, BLOCKED_TILE_TYPE4, };

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

19 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

Related Questions

A node in a childnode? 1 Answer

How i make this code in Unity Javascript 2 Answers

using Application.OpenURL for opening new tab? 2 Answers

Vehicle Won't go past 2nd gear. 1 Answer

Inspector Editor, can 2or more Components be group together in a single Tab? 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