Placing 2d on a grid in Unity3d - c#

I built a small MapEditor for my game in XNA. Now I want to build it in Unity3d, except I don't really understand how this works in Unity3d.
So basically what I want is to create a 2d grid, where I can dynamically add tiles to the grid. Each tile contains a 2d Texture.
I was thinking of using NGUI to help me with this. I want it to be a 2d game.
I've got no idea on how this works in Unity3d. I would appreciate it, if you guys could point me into the correct direction.
Thanks in Advance!

I think the Rotorz tile system is doing exactly what you are looking for. Have a look at: http://u3d.as/content/rotorz-limited/rotorz-tile-system/2UU

Related

Unity pixel art glitch

I'm new to Unity and I'm still learning how to use it. I'm trying to make a pixel 2D game and my character is glithy around the edges and I don't know how to fix it. Thanks for the help!
I tried and watched a lot of tutorials but none of them had the same problem as mine.

How to make a hexagonal shaped "plane" in Unity

So i have already asked about this on the unity forums but i thought i'd ask here too.
Basically i want to create a hexagonal shaped plane object to create terrains, however the "plane" gameobject is square, could anyone point me in the right direction of how to do this?
Thanks in advance
find any hexa plane.obj or even .fbx online , or create it by any builder asset or using unity pro builder.
here is a hexagon.obj
https://drive.google.com/file/d/1K32bE6Kb22u3rt2hl3zoAuqUOvCZlT-r/view?usp=sharing
You can use Unity's Pro Builder Asset to create custom meshes for your game.
Here is some information about it: https://unity3d.com/unity/features/worldbuilding/probuilder
You have a few options....
First of all, does it have to be hexagonal, or just look hexagonal?
You could potentially use a texture with alpha transparency to make it appear hexagonal (although it would still be a full plane for all practical purposes, eg colliders).
Short of that, you need to create a custom mesh (model).
Again, there are lots of ways you can approach this. It's possible to do from inside Unity using code. This is very flexible, but pretty advanced.
Much simpler for now would be to use an external modelling tool (Blender is free and highly thought of).
Whatever you pick, it will almost certainly have a Polygon circle command that will allow you to specify how many points it should use.
Simply enter 6 here and you'll get a perfect hexagon.
Save as .fbx somewhere in your unity project. Unity will import the model and you can then drag it into your scene.

Is there a way to scale unity's render view?

I'm looking to make a game that looks similar to old PS1 games with their rough edges for the rendered models. I'm just starting with Unity, coming from Game Maker, and in Game Maker you could set the width and height of the game's viewport and then upscale it, doubling each pixel's scale, essentially incrementing the render view to achieve a "scaled look". I was wondering if there was a way to do this with Unity.
If anyone has any information on this, that'd be great!
I ended up finding a script to do it for me. After much searching, I found this snippet to that accomplishes what I'm looking for.

is there a way to make a 3D game in winforms or WPF in C#?

I'm thinking about making a 3D point and click game, is it possible to make one in winforms or WPF? I don't need any physics or anything all I need is to make the application render 3D objects. I know that I can use XNA but if I do then I will have to relearn almost everything again. My third approach would be to make the scenes in a 3D game engine and then print the screen and then load it as a image. Any suggestion would be appreciated.
There's a big difference between a 3D game, and just letting players interact with a rendered image.
Your approach of loading a pre-rendered image is possible to do in both Winforms and WPF. You would just need to capture click events on the image and check the location against your list of active areas. Then just handle what needed to be done, ie: move to the next area, activate item, etc.
Edit from comment:
It's not so much which is friendlier. You can host an XNA viewport in Winforms/WPF. It's more about how you want your game to work. If you never have moving 3D scenes, XNA is overkill, and images will work just fine.
If you want dynamic scenes, you'll need to be able to render them on the fly. Then, XNA makes more sense. It is a lot more work though compared to just displaying images.
If you just want to show pre-rendered 3d images in your game, why not create them using a real 3d graphics tool, such as 3D Studio Max or Maya (or a free one, such as Blender)? It sounds like there's no need for actually rendering the 3d scenes in a game engine at all.

XNA 2d arcade game sprite follow

I am going to make a game like XNA example game "Platformer1" which comes with the XNA. But I need longer levels which doesn't fit in the screen (like Super Mario levels). How can I manage this kind of level? Do I need to use a 2d camera that follows the sprite? If I do this way how can I load the level? I am a bit confused and I am not sure if I could explain my problem clearly. Hope someone can help?
The tutorial based on Platformer Starter Kit in MSDN has a step Adding a Scrolling Level which guides you through creation of longer levels. The tutorial is very detailed, I highly recommend it.
I couldn't find the tutorial in the section for XNA Game Studio 4.0, but differences should be minimal. According to the comment at the bottom of the page, all you need to change is replace
spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, cameraTransform);
with
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, cameraTransform);
in the tutorial code.
If you want to create a side scrolling game, then I would look into parallax scrolling. A quick google/bing will help you find lots of tutorials. Also, another useful tip is to search YouTube for XNA videos has we a lot of posters share their source code .
Here is a link to Microsofts Parallax Scrolling.
Sounds like you have a few problems ahead of you.
But I need longer levels which doest'n fit in the screen(like super mario levels). How can I manage this kind of levels.
There are several ways to do this, but a fairly easy way would be to have a 2d array (or sparse array, depending on how large your levels are) of a class named Tile that stores info about the tile image, animation, ...whatever.
Yes, you'll probably want a "camera". This can be as simple as only drawing a certain range of that array or a more featured camera that uses transforms to zoom out and translate across your level.
Hopefully this will help get you started.
I've done a decent amount of work in XNA, and from my experience, there are 2 ways to draw a 2D scene:
1) Strictly 2D. This method is much easier, but has a few limitations. There is no "camera" per se, what you do is move everything underneath the fixed 2D "camera". I say "camera" in quotes because the camera is fixed (as far as I know). The upside is that it's easy, the downside is that you can't easily zoom in or out or do other camera effects.
2) 2D in 3D. Set up a 3D world with a 2D plane. This is more flexible, but is also more challenging to work with because you will need to set up a 3D world and 3D camera. If this is your first attempt with making a game, I would highly recommend against this method.
I'm really only familiar with the strictly 2D method, and you would want a list of map objects that have a 2D coordinate. You would also want to store which section of the map you are looking at, I do this with a Rectangle or Vector2 that stores this. This value would move forward as the character moves. You can then take your 2D map objects' coordinate and subtract the (X,Y) of the top-left of what you are looking at to determine an object's screen position. So:
float screenX = myMapObject.X - focusPoint.X;
float screenY = myMapObject.Y - focusPoint.Y;
An other thing to note, use floats or Vector2/3 to store locations, you may not think it's required now, but it will be down the line.
It might be overkill, but my SF project uses XNA to draw a Strictly 2D scene that you can move around: http://sourceforge.net/projects/asteroidoutpost/
I hope this helps.
Have a look at Nick Gravelyns tutorials. They helped me tonne when I was first starting out - Really really worth a look for learning a lot on 2D games.
All the videos are now on youtube here

Categories

Resources