بازی 2040 یک بازی فکری بسیار محبوب بین نوجوانان است که با جابجا کردن اعداد در آن باید به عدد 2048 برسید.

 

در این آموزش تصویری با نحوه طراحی بازی 2040 با استفاده از  C#.NET و Unity آشنا می شوید.

این دوره آموزشی محصول موسسه Udemy است.

سرفصل های دوره:

  • کار با رابط کاربری
  • طرح بندی صفحه با Unity
  • نحوه مرتب سازی داده ها
  • نصب و راه اندازی Unity
  • نحوه نصب و راه اندازی بازی
  • سفارشی سازی ظاهر بازی
  • نحوه استفاده از RichText
  • کار با عناصر Unity
  • نحوه ایجاد شبکه
  • نحوه اضافه کردن اعداد
  • ساخت بازی های مکانیکی
  • کار با داده های ورودی از صفحه کلید
  • نحوه ذخیره سازی اطلاعات
  • ایجاد لیست سطر و ستون
  • حرکت آیتم ها در بازی
  • نحوه متحرک سازی عناصر
  • نحوه ادغام عناصر
  • ساخت دکمه ها در بازی
  • نحوه امتیاز دهی به بازیکنان در بازی
  • نحوه پیکربندی بازی
  • کار با ویژگی های پیشرفته
  • نحوه تنظیم PlayerPrefs
  • نحوه ساخت انیمیشن
  • نحوه تست و اشکال زدایی برنامه
  • و…

عنوان دوره: Udemy 2048 Build your First Complete Game with Csharp and Unity
مدت زمان: 5 ساعت
نویسنده: Knowledge Base


توضیحات:

Udemy 2048 Build your First Complete Game with Csharp and Unity

Knowledge Base
5 Hours
All Levels

Beginner game developers can use Unity and C# to design and build their first game, a clone of the 2048 math puzzle game
Build a clone of the popular math puzzle game 2048 from scratch using C# and Unity3D
First, we will assemble the visual layout that the players will see on the screen using Unity built-in user interface features (UI).
We will start from creating an empty Unity project and gradually move towards laying out all the UI properly.
You will learn useful tips and tricks of designing the UI so that it looks the same on different screen sizes and screen resolutions.
Then we will switch to writing scripts for the 2048 game.
I will show you how to handle input from user.
We will create a script for storing the colors of tiles in this game, so that you can redesign the game yourself and create new interesting color combinations.
I will show you how to implement 2 main game mechanics of the 2048 game merging and moving tiles on the game field.
And you will learn how to track player scores and store High Score between game launches.
Then we will focus on visual improvements. I will show you how to
add rounded corners to the tiles,
add animations when new tiles appear and when two tiles get merged to make the game look more dynamic.
By the end of this course we will have a highly polished product worthy of publishing in AppStore or PlayMarket.
We've also included downloadable assets and project files all for free so you can follow along with the videos and create your own versions ready for upload.
What are the requirements?
You can be an absolute beginner with Unity UI to take this course.
But I would not recommend this course to complete beginners in C#. I won` be explaining the basics of C# language like: what private, public, void keywords mean, etc... So the scripting sections of this course are designed for people who have at least some previous experience in C#.
You should have Unity installed on your computer to develop the game described in the course, preferably the latest version (any version from 4.6 will have the UI features, but in order to open my projects you will need at least Unity 5)
What am I going to get from this course?
Over 44 lectures and 5 hours of content!
Build a complete game similar to the famous 2048 from scratch with Unity3d and C#.
Work with Unity UI and create complex user interfaces for their games.
Students will understand important concepts of anchoring, parenting and sorting order that are used while working with Unity UI.
Assemble any UI elements in a form of a grid.
Students will learn how to create Unity UI that will look good on different screen sizes and different screen resolutions.
Write code that will handle user input both from keyboard and from touch screen.
Write scripts that will implement all the main mechanics of the 2048 game ' merging and moving tiles on the game field.
Keep track of player`s scores and store HighScores between game launches.
Add animations and delays to their games to make them more dynamic.
Students will get a fully functional Unity project of the 2048 game created in this tutorial. This project is highly customizable ' all the colors can be changed to alter the look and feel of this application.
What is the target audience?
This course is for people who want to learn how to build games similar to the 2048 game from scratch.
The techniques from this course can be applied to a wide variety of other grid-based games. Examples might include ?Match 3? games, Minesweeper, classic games like chess and checkers, tick tack toe, sea battle, etc..

Section 1: Introduction
Lecture 1
Introduction to the 2048 Course
05:43
In this Lecture we will talk about the 2048 game in general. We will discuss how this course is structured and what you will need to know or do in order to take this course.
This course requires students to have the latest version of Unity installed. Any version above Unity 5 will do. Also some previous experience with C# will be a huge plus. Please download the Assets for this course. Everything you will need is a folder called Resources to Start 2048 Development
Lecture 2
About The Author
01:08
My name is Valdimir Limarchenko and I am a Unity3D and C# developer from Ukraine with 2+ years of experience with Unity and 7+ years of programming experience.
I absolutely love making 2d games. Just recently I have worked on a couple of freelance projects that involved a lot of work with Unity UI, so I might include that into my courses. I would like to show you some footage from the game that I am currently developing. It is a simple Egypt-themed puzzle platformer. I am really interested in getting to know my students, so I encourage you to write a comment about yourself, your experience in game dev and your gaming tastes in the discussion section of this course.
Lecture 3
Download Assets to this Course
Article
Lecture 4
FAQ about our courses
6 pages
Section 2: Screen Layout with Unity UI
Lecture 5
Introduction to Section 2
03:30
In this lecture we will set our goals for Section 2 and discuss the means that we will use to achieve it. I will demonstrate a project similar to the one that we will have in the end of Section 2. By then we will have the layout similar to the layout on the sample screenshot fully assembled and everything will be prepared to start writing scripts for our game.
Lecture 6
Creating New Project and Importing Assets
05:43
In this lecture we will create an empty Unity project and import everything from the folder Resources to Start 2048 Development into our newly created project. We are going to drag a sprite with our sample screenshot into the Scene view, save the scene and call it MainScene.
Lecture 7
Introduction to Unity User Interface (UI)
09:04
In this Lecture I will show you how to add new UI elements to your game. I will also experiment with all the UI objects available for us in unity. The most important point of this lecture: All the UI in Unity is a combination of just 2 basic UI components: Image and Text. If you have previous experience with Unity UI, you might want to skip this lecture.
Lecture 8
Parenting and Sorting Order of Unity UI
08:13
In this Lecture I will discuss important concepts of working with Unity UI: Parenting and Sorting Order. We can parent one UI object to another UI object by dragging and dropping the first object onto the second object in Hierarchy tab. Alternatively, objects can be created as a child of an existing game object. To achieve this, just right click on desired parent and create a child game object from the context menu. All the UI elements are sorted in the same order that they appear in Hierarchy tab. Game objects that appear last in Hierarchy are rendered on top. If you have previous experience with Unity UI, you might want to skip this lecture.
Lecture 9
Assembling the Game Screen (Part One)
07:35
In this Lecture we will create a Panel that will serve as a background for our game. And add a title text that will say 2048.
Lecture 10
Assembling the Game Screen (Part Two)
09:33
n this lecture we will add all the other texts, Score HUDs, New Game button to the MainScene. We will also create an Image that will serve as a background for the game field.
Lecture 11
Adding Custom Styling to Parts Of Text Using RichText
07:29
In this lecture we will step back from adding new UI elements to our game. I will show a useful feature that is called Rich Text and we will use it to highlight parts of our text with Bold styling to make our layout similar to the one that we have on the sample screenshot.
Lecture 12
Anchoring of Unity UI
09:57
In this lecture we will look at anchoring of UI elements in Unity. Anchors are little triangles that we see in our canvas when we select any of our UI objects. Understanding how anchoring works is a key to designing UI that will work on different screen resolutions.
If you have previous experience with Unity UI and already understand how anchors affect your UI, you might want to skip this lecture.
Lecture 13
Creating a Grid of Tiles on the Game Field
04:37
In this lecture we will attempt to create a grid of tiles on our game field using Unity`s built-in script called GridLayoutGroup. We will also discuss why this script won`t work for us, and in the next Lecture I will suggest another solution to this issue.
Lecture 14
Making the Grid Resolution Independent
06:26
In this lecture we will make our grid stretch when we resize our screen by using the AutoGridLayoutGroup script that was in the Resources to Start 2048 Development folder. We will also use AspectRatioFitter script to make our game field always preserve square shape.
Lecture 15
Add Numbers to All Tiles on the Game Field
05:13
In the previous Lecture we had just empty tiles on our game field, and in this Lecture I will populate the game field with numbered cells. This will conclude Section 2 and we can now switch to writing scripts and implement main game mechanics.
Section 3: Main Game Mechanic
Lecture 16
Introduction to Section 3
06:53
This Section is the most important and the hardest section in this Course. I will show you how our project will look like by the end of this section and explore some options of customizing the look of our game. We will also discuss main milestones that we will accomplish while writing code for our game. I use a dark theme for MonoDevelop. I just think it is more eyes-friendly. The theme that I use is called Regal Obsidian and it can be downloaded here for free:
Lecture 17
Reading Input from Keyboard
09:56
In this lecture we will create 2 scripts GameManager.cs and InputManager.cs and we will establish aconnection between these two scripts. You will learn how to read input from user. And we will test our code in Unity.
Lecture 18
Storing Color Info for Different Tiles
09:40
In this Lecture we will create a script called TileStyleHolder.cs. It will store the information about the colors of different tiles and the colors of the numbers on the tiles. By changing colors in this script in Unity we can alter the look and feel of our game. You will also learn a useful programming pattern called Singleton that is used to establish connection between scripts and can be applied when we will have just one instance of some script in our game (in our case we will have just one TileStyleHolder).
Lecture 19
Creating a Tile Script
09:40
In this lecture we will create a script Tile.cs that will be attached to all the tiles on our game filed. And we are going to write a couple of methods that will be responsible for applying tile color and text color from our TileStyleHolder component to the actual tiles in our game.
Lecture 20
Clear The Field When the Game Starts
09:57
The goal of this Lecture is to clear the game field from all the number 2 tiles that we have in the scene view when we enter Play mode. To achieve this, we will create a property called Number in our Tile.cs script. When we will change the number on any tile through this Number property, it will automatically apply style from TileStyleHolder or it will clear the tile completely if we assign 0 to the Number property.
Lecture 21
Store the Info About All Tiles in Game Manager
06:36
In this lecture we will create a 2-dimensional array in GameManager.cs to store the references to all the tiles on the game field so that we can move them in code.
Lecture 22
Randomly Generate New Tiles
08:09
In this lecture we will create a List called EmptyTiles to track where we can put a new tile when a new tile needs to be generated. Lists are somewhat similar to arrays. Except, for Lists we don't have to know in advance how many elements will this List hold. So, we can think of a List as a dynamically sized array.
We will create a method called Generate() and hook it up to a key G on our keyboard, so that when we press G, a new tile will be generated.
Lecture 23
Main Game Mechanics Discussion
09:52
In this lecture I will show you a small slideshow. We will discuss the main game mechanics like moving and merging tiles and how these functions will be implemented in code. It is important to understand the concepts of UpIndex and DownIndex moves in order to proceed and write code that will move and merge tiles.
Lecture 24
Create Lists of Rows and Columns
06:02
In this lecture we will create two supplementary Lists called rows and columns and populate them with tiles. This will help us implement moving and merging, because we have to make certain actions in rows and columns separately.
Lecture 25
Create Methods for Shifting Tiles
09:34
In this Lecture we will create two methods that will be responsible for one of our elementary moves. For now we just want them to move 1 tile to a certain direction just for 1 spot. We will use this methods in the next Lecture to implement moving mechanic.
Lecture 26
Moving Tiles on the Game Field
08:18
In this lecture we will connect the methods from the previous Lecture to the Move() method in GameManager. As a result, our tiles will move on the game field, but they won`t merge.
Lecture 27
Merging Tiles
08:46
We will add the code for elementary merges to GameManager(). By the end of this lecture it might seem like the main game mechanics are already working, but there is a small bug in our code that we will discuss in the next lecture.
Lecture 28
Bug Fixes and Automatic Tile Generation
08:48
In this Lecture we will first enable automatic tile generation, so that 2 tiles are generated in the beginning of each game and 1 tile is generated in the end of each move. Then we will encounter an interesting bug new tile is generated even if we have not made an actual move. In order to fix this we have to introduce a bool variable called moveMade. It will help us understand if any moves or merges happened as a result of our move. Only if moveMade returns true after our move, we will generate a new tile.
Lecture 29
New Game Button
05:37
In this lecture we will make a New Game button functional, so that it will just restart our scene and this way a new game will be started for our player. I will also start creating the script called ScoreTracker.cs that will take care of storing player scores and showing them in the ScoreHUDs.
Lecture 30
Score Tracking With PlayerPrefs
09:42
In this lecture we will store the value of our HighScore between game launches using PlayerPrefs. By the end of this lecture all the score tracking features will be fully functional.
Lecture 31
Making Game Over Panel
05:36
In this lecture we will go back to designing UI and we will create a new Panel that will pop up as a message for the player when the Game is over. We will display the amount of point that our player scored during the course of his game.
Lecture 32
Configuring Game Over Panel
04:27
In this Lecture we will connect the Game Over Panel to our GameManager by establishing this connection in the inspector. We will make the Continue button on the Game Over Panel do the same thing that our New Game button does, so it will just start a new game.
Lecture 33
Display Game Over Message
07:54
In this Lecture we will create a method CanMove() that will return a boolean value. This method will help us check if there are moves available in our game. In the end of this lecture I will test everything in Unity and show you the message displayed when the game is over.
Lecture 34
Display You Won Message
06:48
In this Lecture we will display a message if our player gets to the 2048 tile. Because it is hard to get to the 2048 tile to test if this message works correctly, I will show you a little workaround that we can do to test this. So, in the end of this lecture we will get to see a You Won!!! message displayed on the screen.
This Lecture will conclude Section 3 of this Course. By now all the game mechanics are fully functional. In the next Section I will focus on visual improvements that we can make in order to make the game more dynamic.
Section 4: Advanced Features
Lecture 35
Introduction to Section 4
02:45
In this Lecture we will discuss final polishing touches that will make our game look even better. Some of the topics in this Section require advanced scripting skills, so some of the Lectures will be organized as code review. I will just show you the code and we will discuss how it works.
Lecture 36
Add Rounded Corners and Reset PlayerPrefs
06:58
In this lecture we will add rounded corners to the tiles on our game field and to the game field itself. You will learn about a 9-slicing technique that can help us stretch small sprites on big areas without distorting their corners.
Lecture 37
Coroutines Example
09:53
In this Lecture we will look at a simple example of using coroutines. Coroutines let us execute code in a separate thread and wait for certain amounts of time during code execution. We will use coroutines to add delays between elementary moves in our game.
Lecture 38
Preview of Delays
02:50
In this short Lecture I will show you how our game will look with delays.
Lecture 39
Delays Code Review
09:35
In this Lecture we will just look at the code that enables delays in our game. This might be the hardest part of this course, especially if you have not been familiar with coroutines. If you have any questions, feel free to ask them in the discussion section for this course. Coroutines are a great tool that opens a lot of opportunities in game development, and I use them all the time. So I highly recommend you to invest some of your time and master coroutines. You won`t regret this, I promise)
Lecture 40
Creating Animations for Tiles
09:46
In this lecture we will create 3 Animations for our tiles: Idle, Merge, Appear. We will configure transitions between our animations in the Animator component. I will show you a useful technique of applying the animations the animations that we have created for one game object to multiple game objects.
NOTE: This will work because the child game objects that we are accessing in our animations are named the same for all tiles (NumberedCell). This might not work if all the NumberedCells were named differently.
Lecture 41
Enabling Animations in Code and Testing
06:00
In this lecture we will create 2 methods to call the animations on our tiles from the GameManager. We will call these methods on all newly created and merged tiles. In the end of this lectures we will see how the animations that we have created look in our game.
Lecture 42
Bug Fixes and Touch Input Code Review
06:04
In this Lecture I will fix a bug that caused the controls in our game to freeze if the move that we initiated did not result in any actual moves or merges of tiles. This bug was introduced in Lecture 5 of this section and is caused by the wrong placement of the line:
State = GameState.Playing;
This line should be placed in the very end of the Move() method in GameManager.cs.
We will also review the code from the class TouchInputManager.cs. It is similar to the class InputManager.cs and it will handle controlling our game with swipes on mobile devices.
Section 5: Bonus lectures and extras
Lecture 43
Conclusion
05:19
In this lecture I will show you how the game that we have been working on looks and feels on my Android Tablet. I will talk about the adjustments that I had to make before building this game. You will get the final version of this project and an Android apk in the Assets for this course.
Thank you very much for taking this course!!!
Please let me know your opinion about this course in the discussion section.
Lecture 44
Get Discounts on Other Udemy Courses We Teach
11 pages