This blog contains information about next level features using Unity 2D.
First, We need Following Image Objects : Player, Meteor(Enemy), Star(Ally), Button and Background(optional). In my part, I created these object using Adobe Illustrator and some on internet.
Then I need 4 Scene in the Asset; Level01,Level02,Level03 and MainMenu. There I proceed to File to Build Settings to drag and drop this Scene, we should see like this.
Lets start setting up our main menu, double click main menu from Assets. I need 3 Buttons for my level selection and a Reset button.There I put text from ui for Main Menu and Select Level title, then for the buttons I used the button image I have so we see like this. You can setup the Text in the child of the button.
Scene Button
Reset Button
Here in the Components we setup Onlick Event with our level buttons and to reset. I also have MainMenuControlObject, here I will attach Script called MainMenuControl so our buttons will properly work.
Here I drag Level 2 and 3 buttons.
Lets get started to our Level 1 Scene, In my asset I double click Level 1 Scene. Then same procedure, I created several objects such as text for LevelNumber, GameOver and YouWin texts. After that I drag my player, meteor and start object into the scene.
Text Scene
In the texts, I have the same setup except to the script file in Level Number. The star and meteor has their own 2D Collider where IsTrigger is Enabled while on my player I have RigidBody 2D 2D Collider isTrigger is Disabled and gravity scale to 0. Then I created an Empty Object called LevelControl I need Script for all of this objects to work out.
Level Control Script
Meteor Script
Player Movement Script
Star Script
Now We are nearly done, lets create folder called prefab; from the Level01 Scene, I need to drop all the objects inside the prefab. From here I will copy the objects and drag to our proceeding scenes which 2 and 3.
Prefab Container
Level 3 Scene
Level 2 Scene
Now we are done, here is my final output. Thank you.
No comments:
Post a Comment