29 Apr 2022

Unity - Essentials of real time 2d - Working with Game Objects

Make and manipulate a Sprite:

2d objects include a library of Sprites. I made a circle shape and applied the 'knob' sprite to it. Then edited shape using the transform tool 'T' on keyboar same as Photoshop for free transform. Shift locks dimensions. Changing colour of the sprite is easy in the Inspector to the right.


Adding Components to 2d game objects:

In the Inspector the circle is given a rigidbody and a circle collider component - (added right at the bottom of the Inspector). A box is added below and also given similar components. Now the circle drops but stops when it hits the box or ground below.

Do NOT make changes whilst the game is running - changes will be lost. 

Sprites and readymade 2d or 3d art can be found at the Unity Asset Store so I grabbed a few to make my next exercise. Sprites tend to be low rez png files with transparency. To load them you go to Window/ package managaer in Unity. if you download them from the asset store you can download into the Unity package manager and then from there import them into the project.

Publishing the game to WebGL so it runs on a browser requires the WebGL Publisher package to be loaded. Instructions are here

click pic to run my Egg Pachinko

 

No comments: