Over the course of this series, we’re going to recreate one of my all time favorite C64 games: Lode Runner! Orthello 2D Framework: There are several different sprite plugins available for Unity, the most popular being Sprite Manager 2 which I have used extensively and wrote about in my earlier 2D game tutorial series. A* Pathfinding Project: A* Pathfinding is probably the most widely used pathfinding system available for Unity. TexturePacker: TexturePacker is a standalone app that makes it easy to create sprite sheets from your textures. Install the latest version of Unity and then create a new project by going to File -> New Project, click the Set… button and browse to a location on your drive where you want to save your Unity projects, enter a name for the project and then click Save.
When the Import Package window appears, make sure that all the checkboxes are checked and then click Import. The Orthello website has tons of detailed information on setting up and working with the plugin so be sure to take a look. In the Unity Project view, go to Orthello -> Objects and then drag the OT prefab into either the Scene view or the Hierarchy. The OT prefab acts as a parent for Animations and Sprite Containers that we will be adding to the scene later on. As I write this, the free version of A* Pathfinding is not available for download from the Unity Asset Store (the paid version is though). Go to the website, click on Download Latest Version and then click on A* Pathfinding Project in the Download area which should download a file named PathfindingProject_Free.unitypackage onto your computer. Double click on PathfindingProject_Free.unitypackage which will open the Importing Package window in Unity. Add the Astar Path script to the game object by going to Component -> Pathfinding and then click on Pathfinder.
With the A* object selected in the Hierarchy, you should see Astar Path script’s options in the Inspector. If you followed all of the steps above, then your project should look something like this (click to see larger image). The cool thing about the project is that you can use this as a starting point for creating all kinds of 2D games so keep this around as a base for starting new 2D projects (although be sure to check for the latest versions of the scripts). If you find these tutorials useful, please considering buying one or more of our games and apps for iPhone and iPad. Tim Miller is a veteran game developer with over 15 years experience in the video game industry working as a Level Designer and Lead Level Designer at LucasArts, Secret Level and Nihilistic Software. Welcome to part 2 of this tutorial series on making a Lode Runner-style 2D game with Unity 3D. Of all the Unity plugins we covered in part 1, the main plugin we’ll be focusing on in this installment of the series is Orthello 2D.
Under Per-Platform Settings click on the little world icon (assuming you set your platform to Web Player in the previous step). Click on Resolution and Presentation and change the Screen Width to 800 and the Screen Height to 600.
In the Unity Project tab, go to Orthello –> Objects and then drag the OT object into either the Scene or the Hierrachy tab. In the Hierarchy tab, drop down the little arrow next to the OT object and then click on View. Now if you select the Main Camera in the Hierarchy, you’ll see that Projection is set to Orthographic and Size is set to 10. At this point, your project should look something like the following image (click to see a larger image). Ok now that all that initial setup stuff is out of the way, it’s time to dig in and have some fun. Now if you click the Publish icon in TexturePacker and then switch back to Unity, you should see a SpriteAtlases folder in the Project tab with the sprite atlas and a sprite data files inside. Drag the level.xml from the Project, SpriteAtlases folder and drop it on to the Atlas Data File slot. The brick needs to have some animations on it that will play when it’s destroyed and when it regenerates so we need to make an Animation.
With the new OTAnimation still selected, adjust the settings to match those in the following image. Now you should see a brick sprite in your scene and if you press Play in Unity, the sprite will animate through all of the frames in the animation. We need some Layers too so under User Layer 8, type Ground and under User Layer 9 type Ladder.
Click on the brick object in Hierarchy and the drop down the Tag list in the Inspector and select Ground.
Drag the brick object from the Hierarchy and drop it into the Prefabs folder in the Project tab. If your brick object is still sitting in the center of the Scene, move it to the side so it’s out of the way.
Drag the level object that we created earlier from OT –> Containers and drop it on to the Sprite Container slot in the Inspector. Your sprite will appear but it looks like the brick sprite that we made before, that’s because the brick is the first texture on the Sprite Atlases index. Drag the concrete object from the Hierarchy into the Prefabs folder in the Project tab to create prefab from the object.
Move concrete tile out of the way if it’s still sitting in the center or the Scene view. Change the Frame Index to 15, the sprite in the Scene view should now look like a ladder segment. Change the Frame Index to 17 so that it looks like a black cube with a white line across the top (that’s our rope tile!).
Now make prefabs from the ladder and rope by dragging each of the objects from the Hierarchy into the Prefabs folder in the Project tab. Now we have all the sprites necessary for making levels, but before we start we need to make a border object that will sit at the bottom of the screen. Drag and drop the border bottom object from the Hierarchy into the Prefabs folder in the Project tab to turn it into a prefab.
A small amount of the cube should be visible above the bottom of the Game view and it shouldn’t quite be all the way to each edge.
Select the border material and then in the Inspector click on the white area beside the little eye dropper icon, this will open up the color picker.
Drag the border material and drop it on to the border bottom object in the Hierarchy to apply the material. We’re almost ready to make a level, but first lets change the background color to black.
At this point you can just start duplicating the brick, concrete, ladder and rope tiles around the scene to make a level.
Remember that bottom border cube we made before, well you can use that as a base line for snapping your cubes so that you can build the entire level on a grid. You can also select several tiles at the same time either with shift+left click or by dragging an area around a bunch of tiles.


I hope you enjoyed this post and learned a little more about how to make 2D games with Unity. If you like this post, please be sure to say hi in the comments and follow me on Twitter and Facebook. I have been stuck with where to start on 2d game development for quite a while now, after finding your tutorial I now feel that I am starting to build a solid foundation of knowledge with which I can start making my own 2d games, Thank you very much for a great tutorial. In my version, in the Orthello folder there is not a prefab named OT, but 7 prefabs, each one apparently slightly different from OT prefab in version 3.x of Unity. This tutorial assumes that you have already followed along with Part 2 of this series so your project should be ready to continue on with the steps below.
If you don’t already have the project open in Unity, open it now and then load the scene that you created in Part 2 (eg. In the Hierarchy tab, expand the OT object and then the Containers object and you will see your new container with a name something like “Container (id=-6840)“. Drag the player.xml from the Project, SpriteAtlases folder and drop it on to the Atlas Data File slot. Next find the AnimatingSprite object in Orthello –> Objects –> Sprites object in the Project tab and drag it into the Hierarchy, this will make a new object in the scene with a name like “Animating Sprite (id=-23050)“. With the new player object still selected in the Hierarchy, drag the “player anims” object on to the Animation slot. Now you should see the player sprite in your scene and if you press Play in Unity, the sprite will animate through all of the frames in all of the animations.
In order for the player to collide correctly with the ladder and rope colliders we’ll be creating later, we need to set the following. If you followed the steps above, the settings on the player sprite should look like the following image.
Changing the Depth to -1 and the Center Z to 1 on the Box Collider will position the Collision at 0 on the Z axis while moving the player sprite 1 unit towards the camera.
We need to add another animating sprite so that when you press the fire button, you’ll see a bullet blob animate from the player and hit the ground.
Next find the AnimatingSprite object in Orthello –> Objects –> Sprites in the Project tab and drag it into the Hierarchy, this will make a new object in the scene with a name like “Animating Sprite (id=-23050)“. With the new shoot object still selected in the Hierarchy, drag the “shoot anim” object on to the Animation slot. Set the Transform Position X to -1 so that the sprite is position to the left of the player’s sprite. Now you should see the shoot sprite in your scene and if you press Play in Unity, the sprite will animate through all of the frames in all of the animations. We only want to see the shoot sprite when the player is actually shooting so uncheck the checkbox next to Mesh Render on the shoot sprite.
In the Hierarchy, drag and top the shoot sprite on to the shoot parent so that the shoot sprite becomes a child of the shoot parent object. Drag and drop the shoot parent object on to the player sprite so that it’s a child of the player. If you followed all the steps so far, your Hierarchy should look something like the following image. Note that in order for the scripts to work, the child objects under the player must be named exactly as shown in the above image. Drag and drop the xa.cs file from the Project tab onto the Scripts object in the Hierarchy. Make sure that the player is positioned above a brick tile so that she has something to stand on. Now if everything is setup correctly, when you press Play in Unity the player should stand on a brick tile without falling through it.
Describing how the scripts work is beyond the scope of this tutorial, but I did add comments to the scripts that should hopefully help you understand how everything is working. Every ladder in the scene needs to have one of these Ladder colliders and we need to adjust the size of the Ladder colliders to match the height of each of the ladders in the level. Assuming your ladder is 4 sprites high: Select the Ladder collider and change the Scale Y to 5 (1 unit taller than the visible ladder).
Snap the Ladder collider to one of the lower corners of the bottom sprite using the Vertex Snap feature in Unity. You can duplicate this object, resize the Y and snap it to all the other ladder sprites in your level.
Now if you press Play in Unity and then walk the player over to the ladder, she should be able to climb up and down the ladder, the player’s sprite should be playing the climb animation and you should be able to exit the ladder at the top and bottom levels and also fall off the ladder if you exit somewhere in the middle. Assuming your rope is 4 sprites wide: Select the Rope collider and change the Scale X to 4 (Y and Z scale should be 1). Snap the Rope collider to one of the lower corners of the bottom sprite using the Vertex Snap feature. You can duplicate this object, resize the X and snap it to all the other rope sprites in your level. Now if you press Play in Unity and then walk the player over to the rope, she should be able to climb left and right along the rope, you should see the rope hang animation playing and if you press the down arrow while hanging from the rope, she should let go of the rope and fall. You can download the project up to this point and you can play the web version of the project here.
When I began this series, It was my intention to include enemies that could follow the player around the level using behaviors similar to the original Lode Runner game.
If you are a programmer who would like to contribute an AI behavior solution to this tutorial series, please contact me. I had problems with the tag, however after arranges them on line 144 of player.cs also needs to be fixed, there was a change in orthello, it took me to find the error.
Thank you Kyle, that seemed to work for the animation issues I was having for this part in the tutorial. Hi Everyone, Clearly a lot of people have had problems after the section where the code is added.
Here are the steps I used to fix my problems and hopefully it will help someone out, firstly I did not have to make any changes to the code.
Firstly I realised that my player was too far along the z axis and so the collider box was not touching the bricks, I was also unable to make changes to the z axis, when I typed in a new number it simply reverted back.
As someone has already mentioned, if you change the depth of the player instead of the z axis in the transformation section you can successfully move the player. Second, my bricks were not aligned properly in the z axis and could not be moved similar to player. I recommend you try those if you are having similar problems to me, it took me a lot of trial and error to fix this and I hope it will help someone else. I’ve spent a few hours the last couple of nights trying to figure out why my character keeps failing through the bricks and landing on the bottom game object. I came into work this morning after having nightmares about falling through floors and decided to check out the comments. I was thinking I would try out Orthello using your tutorial and then if I felt I needed the extra functionality of the pro-version I would buy it.
However now I see 2d Toolkit is on sale and at that price and the amount of positive reviews I think I will pick that up.


I see all these cool assets on the asset store and am not all that sure how useful they are to someone with a lot of software development experience but very little game development experience. Many of the assets seem geared towards removing coding as part of the game development work flow. I don’t understand why it appears, considering that i did everything correctly as the tutorial and everything works fine in the game. Thanks you very much for all the tutorials, but i have to said, that this inst really a tutorial, i think is just a step by step guide to do something but not understanding nothing of wath is going on behind. In This installment of our 2D tutorial series, we will be adding enemy AI to our Lode Runner clone using A* Pathfinding. Adding the enemy AI required changes to many of the scripts that we added in the previous tutorials. Many of the scripts have been modified since Part 4 of this series, so you’ll need to update them.
Note that some of these may be unnecessary or redundant depending on how your project is currently setup. A* is a graph traversal algorithm widely used in computer science, and commonly used in games for path finding. More accurately, the path returned is the “least cost” path, because nodes have a specified penalty cost for traveling along it.
We don’t make use of penalties in this game because traveling along ropes, ladders, the ground, and falling is all done at the same speed.
A game could have multiple graphs, for use by the various units (ships have different travel behavior to an infantry man for example).
The node connections generated by the base GridGraph are always bidirectional (if it creates a connection from from node1 to node2 then it will also create a connection from node2 to node1) which is not necessarily what we want.
We could use the base GridGraph and not bother about having any fall lanes, it would just mean that our AI would not plan any paths that involve letting go of ropes or running off platforms. Our enemies and the player classes both derive from the Character class which implements the movement code. The Enemy script has 3 slots that need to be filled: Player and Player Tr (drag the player gameobject to those slots), and Target (drag the path target gameobject to this slot).
While the enemy AI is not a completely faithful recreation of the original, it is hoped that it will provide you with enough of an idea on how you can use and implement A* path finding in your own creations.
The AI scripts and this tutorial were contributed by Adrian Seeto of Fun Mob Games, creators of Pocket BMX game for iOS, a free-roaming 2D bike tricking game with physics. Realize this is a dated tutorial, but the bug fixing is actually beneficial for me anyway I figure. Unity has built in 2D tools now so you shouldn’t need to use a 3rd party sprite tool (unless you need more advanced features). Its surprising how much you can learn by taking things slowly and gaining an understanding of what the tutorial is telling you to do rather than just following it blindly.
However, I am trying to adapt it for iPad for my own experience, and am having a very tough time setting up the camera to be in the center of a 1024×768 screen. This is the Container that will hold all of our player sprites from the atlas we made so you can rename the Container to something obvious like “player“. Now if you drop down the little Atlas Data arrow, you should see that it’s populated with all the sprite atlas data that TexturePacker generated for us. This will add a new object under OT –> Animations named something like “Animation (id=-4320)“. To populate the Container field, drag & drop the “player” object from OT –> Containers on to the Container field. The Sprite Container slot should automatically fill with a reference to the “player” container object, if it doesn’t you can drag & drop that onto the slot. To populate the Container field, drag & drop the “level” object from OT –> Containers on to the Container field. The Sprite Container slot should automatically fill with a reference to the “level” container object, if it doesn’t you can drag & drop that onto the slot. Had to make a few modifications to get it to work properly, probably mostly because of the software updates, but nothing inaccessible to a decent programmer. Some more explanations would be welcome regarding particular settings or arbitrarily chosen values.
The player was flickering between poses but after fixing the problem with the object positioning this fixed itself for some reason.
I don’t know why there does not seem to be official tutorials by these 2d framework makers (2d Toolkit, Orthello, SM2). Is there some blocking blocks built outside the camera view ?(am I missed when looking through the tutorial?) Looking forward for helps, thanks! The script checks if the ray intersects the size of the screen, and if so, blocks the character from progressing. If you don’t do that you will notice your collider being reset to 0 and then you fall through. As the runLeft and runRight animations are 3 frames long, you have to keep it in range of 0-2.
Note I’m not sure why Adrian turns off pixel perfect, feel free experiment on your own.
Your support helps to keep these tutorial coming so be sure to follow us on Twitter and Facebook. There are a couple of bits that have messed up but I thought using the updated scripts would help!
The next day I created some more sprites and the border bottom, but they’re suddenly all on another z value than my first object which makes alignment in the scene a bit confusing. Select bricks and player switch to left view hmmmm green box colliders seem to be along the same z plane. I should have checked the comments section right away I just figured I was the problem, not the code. I probably would have bought one by now if I knew I could fallow a tutorial and see how hard or difficult the tool was. Then I figured that I put all the elements under LEVEL like Tim did & it changed their Z position in Transform.
This will be a transform that the enemy script will move around to place on the desired target for our path finding AI. The problem is I cannot change the z value for the first object, only when I deactivate the OTAnimating Sprite script object, I can change it, but it snaps back to the old value as soon as I re-activate the script.
If your game enforces lethal falls from great heights, then you would need additional logic.
A fall lane is a term I’ve made up for a vertical one-way path that you can only travel on by falling. You should therefore see that the AI can travel along the surface of ground tiles, along ropes, and up and down ladders.



Marketing research tools ppt
Microsoft windows movie maker free download vista
Marketing campaign planning software online
Interactive marketing campaigns health


Comments to «How to make a video game unity3d basics part 1»

  1. JXL Says:
    Involved in graphic designing, web designing, film direction & production, fashion photography device sales has opened up a new.
  2. tana Says:
    Superb education has helped them to understand their career would be well advised to let.
  3. FREEGIRL19 Says:
    Much function, this is the very best video editor cart computer software, email.
  4. LEDI_PLAGIAT_HOSE Says:
    This Denver Video Production Studio proved and moral or ethical problems how to make a video game unity3d basics part 1 that can windows 7, Windows 8 tried.