<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gameplay Archives - Oxmond Technology</title>
	<atom:link href="https://oxmond.com/tag/gameplay/feed/" rel="self" type="application/rss+xml" />
	<link>https://oxmond.com</link>
	<description>IT Development</description>
	<lastBuildDate>Wed, 18 Nov 2020 04:49:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0</generator>
	<item>
		<title>How To Download Unity Using Unity Hub</title>
		<link>https://oxmond.com/how-to-download-unity-using-unity-hub/</link>
					<comments>https://oxmond.com/how-to-download-unity-using-unity-hub/#respond</comments>
		
		<dc:creator><![CDATA[Oxmond Technology]]></dc:creator>
		<pubDate>Wed, 14 Aug 2019 20:27:17 +0000</pubDate>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[2D]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game engine]]></category>
		<category><![CDATA[game maker]]></category>
		<category><![CDATA[gameplay]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unity hub]]></category>
		<category><![CDATA[Unity3d]]></category>
		<category><![CDATA[windows 10]]></category>
		<guid isPermaLink="false">https://oxmond.com/?p=489</guid>

					<description><![CDATA[<p>Unity tutorial for beginners. How to download the Unity game engine for PC (Windows) or Mac (MacOs). In this tutorial we will download and install the free Unity (Unity3D) software from unity.com using Unity Hub. ···················································································· ❤️ Subscribe to Oxmond Tutorials. Stay ahead of the...</p>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-download-unity-using-unity-hub/">How To Download Unity Using Unity Hub</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Unity tutorial for beginners.<br />
How to download the Unity game engine for PC (Windows) or Mac (MacOs). In this tutorial we will download and install the free Unity (Unity3D) software from unity.com using Unity Hub.</p>
<p>····················································································</p>
<p>❤️ Subscribe to Oxmond Tutorials. Stay ahead of the game:<br />
<a href="https://bit.ly/SubscribeOxmondTutorials">https://bit.ly/SubscribeOxmondTutorials</a></p>
<p>✅ Need inspiration for your game? Check Out the Free Asset Packages at the Unity Assets Store:<br />
<a href="https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k">https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k</a></p>
<p>😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:<br />
<a href="https://shop.oxmond.com/discount/OXMONDSALE">https://shop.oxmond.com/discount/OXMONDSALE</a></p>
<p><span style="font-size: 14px;"><em>Asset Store links sponsored by Unity. Any support is truly appreciated so we can keep on making high quality content</em></span></p>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-download-unity-using-unity-hub/">How To Download Unity Using Unity Hub</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oxmond.com/how-to-download-unity-using-unity-hub/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Buttons! How to create and script a button</title>
		<link>https://oxmond.com/how-to-create-and-script-buttons/</link>
					<comments>https://oxmond.com/how-to-create-and-script-buttons/#comments</comments>
		
		<dc:creator><![CDATA[Oxmond Technology]]></dc:creator>
		<pubDate>Wed, 22 May 2019 12:51:23 +0000</pubDate>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[2D]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[coding pirates]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[down]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[gameplay]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[press]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Unity3d]]></category>
		<category><![CDATA[up Unity]]></category>
		<guid isPermaLink="false">https://oxmond.com/?p=455</guid>

					<description><![CDATA[<p>How to create buttons in Unity? Let&#8217;s have a look. We will create and script buttons in this Unity tutorial for beginners. ❤️ Subscribe to Oxmond Tutorials. Stay ahead of the game: https://bit.ly/SubscribeOxmondTutorials ✅ Check Out the Free Asset Packages at the Unity Assets Store:...</p>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-create-and-script-buttons/">Buttons! How to create and script a button</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>How to create buttons in Unity? Let&#8217;s have a look. We will create and script buttons in this Unity tutorial for beginners.</p>
<hr />
<p>❤️ Subscribe to Oxmond Tutorials. Stay ahead of the game:<br />
<a href="https://bit.ly/SubscribeOxmondTutorials">https://bit.ly/SubscribeOxmondTutorials</a></p>
<p>✅ Check Out the Free Asset Packages at the Unity Assets Store:<br />
<a href="https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k">https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k</a></p>
<p>😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:<br />
<a href="https://shop.oxmond.com/discount/OXMONDSALE">https://shop.oxmond.com/discount/OXMONDSALE</a></p>
<hr />
<p><strong>The Button script:</strong></p>
<pre>
/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using UnityEngine;
using UnityEngine.Events;

public class Button : MonoBehaviour
{

    public Sprite btnUp;
    public Sprite btnDown;
    public UnityEvent buttonClick;

    void Awake()
    {
        if (buttonClick == null) { buttonClick = new UnityEvent(); }
    }

    void OnMouseDown()
    {
        GetComponent().sprite = btnDown;
    }

    void OnMouseUp()
    {
        print("Click!");
        buttonClick.Invoke();
        GetComponent().sprite = btnUp;
    }
}

</pre>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-create-and-script-buttons/">Buttons! How to create and script a button</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oxmond.com/how-to-create-and-script-buttons/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>How to make multiple copies (clones) of a GameObject. Unity 2019 beginner tutorial</title>
		<link>https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/</link>
					<comments>https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/#respond</comments>
		
		<dc:creator><![CDATA[Oxmond Technology]]></dc:creator>
		<pubDate>Thu, 16 May 2019 17:41:45 +0000</pubDate>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[coding pirates]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[gameplay]]></category>
		<category><![CDATA[instantiate]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Unity3d]]></category>
		<guid isPermaLink="false">https://oxmond.com/?p=448</guid>

					<description><![CDATA[<p>How to clone, copy, duplicate&#8230;developers call this &#8220;to instantiate an object&#8221;. In this video we will take a look at how we can clone (instantiate) an object. It&#8217;s easy and very, very useful in almost all kinds of game development. ❤️ Subscribe to Oxmond Tutorials....</p>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/">How to make multiple copies (clones) of a GameObject. Unity 2019 beginner tutorial</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>How to clone, copy, duplicate&#8230;developers call this &#8220;to instantiate an object&#8221;. In this video we will take a look at how we can clone (instantiate) an object. It&#8217;s easy and very, very useful in almost all kinds of game development.</p>
<hr />
<p>❤️ Subscribe to Oxmond Tutorials. Stay ahead of the game:<br />
<a href="https://bit.ly/SubscribeOxmondTutorials">https://bit.ly/SubscribeOxmondTutorials</a></p>
<p>✅ Check Out the Free Asset Packages at the Unity Assets Store:<br />
<a href="https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k">https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k</a></p>
<p>😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:<br />
<a href="https://shop.oxmond.com/discount/OXMONDSALE">https://shop.oxmond.com/discount/OXMONDSALE</a></p>
<hr />
<pre>/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using UnityEngine;

public class Coin : MonoBehaviour
{
    void Update()
    {
        transform.Rotate(new Vector3(0f, 100f, 0f) * Time.deltaTime);
    }
}
</pre>
<pre>/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using System.Collections.Generic;
using UnityEngine;

public class Gameplay : MonoBehaviour
{

    public GameObject coinOriginal;
    public GameObject coinContainer;

    void Start()
    {
        CreateCoins(60);
    }

    private void CreateCoins(int coinsNum)
    {
        for (int i = 0; i &lt; coinsNum; i++)
        {
            // GameObject CoinClone = Instantiate(coinOriginal);
            GameObject CoinClone = Instantiate(coinOriginal, new Vector3(i * 0.6f, coinOriginal.transform.position.y, i * 0.75f), coinOriginal.transform.rotation);
            CoinClone.name = "CoinClone-" + (i + 1);
            CoinClone.transform.parent = coinContainer.transform;
        }
    }

    public void DestroyAllCoins()
    {
            var coins = new List();
            foreach (Transform child in coinContainer.transform) coins.Add(child.gameObject);
            coins.ForEach(child =&gt; Destroy(child));
    }


}
</pre>
<p>The post <a rel="nofollow" href="https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/">How to make multiple copies (clones) of a GameObject. Unity 2019 beginner tutorial</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Create the Iconic Asteroids Arcade Gameplay! Unity 2019 Intermediate Tutorial</title>
		<link>https://oxmond.com/asteroids-arcade-gameplay/</link>
					<comments>https://oxmond.com/asteroids-arcade-gameplay/#comments</comments>
		
		<dc:creator><![CDATA[Oxmond Technology]]></dc:creator>
		<pubDate>Mon, 13 May 2019 10:07:34 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[2D]]></category>
		<category><![CDATA[Asteroids]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[coding pirates]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[gameplay]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[skybox]]></category>
		<category><![CDATA[star]]></category>
		<category><![CDATA[stars]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[Unity3d]]></category>
		<guid isPermaLink="false">https://oxmond.com/?p=445</guid>

					<description><![CDATA[<p>Learn how to setup and code the iconic Asteroids shooter arcade gameplay originally designed by Lyle Rains &#38; Ed Logg and released by Atari in 1979. ···················································································· ❤️ Subscribe to Oxmond Tutorials https://bit.ly/SubscribeOxmondTutorials 🚀 Play the game here: https://oxmond.com/games/asteroids/ ✅ Download the free star skybox here...</p>
<p>The post <a rel="nofollow" href="https://oxmond.com/asteroids-arcade-gameplay/">How to Create the Iconic Asteroids Arcade Gameplay! Unity 2019 Intermediate Tutorial</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Learn how to setup and code the iconic Asteroids shooter arcade gameplay originally designed by Lyle Rains &amp; Ed Logg and released by Atari in 1979.</p>
<p>····················································································</p>
<p>❤️ <strong>Subscribe to Oxmond Tutorials</strong><br />
<a href="https://bit.ly/SubscribeOxmondTutorials">https://bit.ly/SubscribeOxmondTutorials</a></p>
<p><strong>🚀 Play the game here:</strong><br />
<a href="https://oxmond.com/games/asteroids/">https://oxmond.com/games/asteroids/</a></p>
<p>✅<strong> Download the free star skybox here (Real Stars Skybox):</strong><br />
<a href="https://assetstore.unity.com/packages/3d/environments/sci-fi/real-stars-skybox-116333?aid=1100l4p9k">https://assetstore.unity.com/packages/3d/environments/sci-fi/real-stars-skybox-116333?aid=1100l4p9k</a></p>
<p>✅<strong> Download Yughues Free Rocks here:</strong><br />
<a href="https://assetstore.unity.com/packages/3d/environments/yughues-free-rocks-13568?aid=1100l4p9k">https://assetstore.unity.com/packages/3d/environments/yughues-free-rocks-13568?aid=1100l4p9k</a></p>
<p>✅ <strong>Download the Rocket mesh here:</strong><br />
<a href="https://assetstore.unity.com/packages/3d/vehicles/space/atom-rocket-model-140021?aid=1100l4p9k">https://assetstore.unity.com/packages/3d/vehicles/space/atom-rocket-model-140021?aid=1100l4p9k</a></p>
<p>✅ <strong>Other free Asset Packages at the Unity Assets Store:</strong><br />
<a href="https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k">https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k</a></p>
<p>😷👕 <strong>Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:</strong><br />
<a href="https://shop.oxmond.com/discount/OXMONDSALE">https://shop.oxmond.com/discount/OXMONDSALE</a></p>
<hr />
<p><strong>Asteroid.cs</strong></p>
<pre>/*

   .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com 

*/

using UnityEngine;

public class Asteroid : MonoBehaviour
{

    public GameObject rock;
    public Gameplay gameplay;
    private float maxRotation;
    private float rotationX;
    private float rotationY;
    private float rotationZ;
    private Rigidbody rb;
    private Camera mainCam;
    private float maxSpeed;
    private int _generation;

    void Start()
    {

        mainCam = Camera.main;

        maxRotation = 25f;
        rotationX = Random.Range(-maxRotation, maxRotation);
        rotationY = Random.Range(-maxRotation, maxRotation);
        rotationZ = Random.Range(-maxRotation, maxRotation);

        rb = rock.GetComponent();

        float speedX = Random.Range(200f, 800f);
        int selectorX = Random.Range(0, 2);
        float dirX = 0;
        if (selectorX == 1) { dirX = -1; }
        else { dirX = 1; }
        float finalSpeedX = speedX * dirX;
        rb.AddForce(transform.right * finalSpeedX);

        float speedY = Random.Range(200f, 800f);
        int selectorY = Random.Range(0, 2);
        float dirY = 0;
        if (selectorY == 1) { dirY = -1; }
        else { dirY = 1; }
        float finalSpeedY = speedY * dirY;
        rb.AddForce(transform.up * finalSpeedY);

    }

    public void SetGeneration(int generation)
    {
        _generation = generation;
    }

    void Update()
    {
        rock.transform.Rotate(new Vector3(rotationX, rotationY, 0) * Time.deltaTime);
        CheckPosition();
        float dynamicMaxSpeed = 3f;
        rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -dynamicMaxSpeed, dynamicMaxSpeed), Mathf.Clamp(rb.velocity.y, -dynamicMaxSpeed, dynamicMaxSpeed));
    }

    void OnCollisionEnter(Collision collisionInfo)
    {
        if (collisionInfo.collider.name == "Bullet(Clone)")
        {
            if (_generation &lt; 3)
            {
                CreateSmallAsteriods(2);
            }
            Destroy();
        }

        if (collisionInfo.collider.name == "Rocket")
        {
            gameplay.RocketFail();
        }
    }

    void CreateSmallAsteriods(int asteroidsNum)
    {
        int newGeneration = _generation + 1;
        for (int i = 1; i &lt;= asteroidsNum; i++)
        {
            float scaleSize = 0.5f;
            GameObject AsteroidClone = Instantiate(rock, new Vector3(transform.position.x, transform.position.y, 0f), transform.rotation);
            AsteroidClone.transform.localScale = new Vector3(AsteroidClone.transform.localScale.x * scaleSize, AsteroidClone.transform.localScale.y * scaleSize, AsteroidClone.transform.localScale.z * scaleSize);
            AsteroidClone.GetComponent().SetGeneration(newGeneration);
            AsteroidClone.SetActive(true);
        }
    }

    private void CheckPosition()
    {

        float sceneWidth = mainCam.orthographicSize * 2 * mainCam.aspect;
        float sceneHeight = mainCam.orthographicSize * 2;
        float sceneRightEdge = sceneWidth / 2;
        float sceneLeftEdge = sceneRightEdge * -1;
        float sceneTopEdge = sceneHeight / 2;
        float sceneBottomEdge = sceneTopEdge * -1;

        float rockOffset;
        if (gameplay.allAsteroidsOffScreen)
        {
            rockOffset = 1.0f;
            float reverseSpeed = 2000.1f;

            if (rock.transform.position.x &gt; sceneRightEdge + rockOffset)
            {
                rock.transform.rotation = Quaternion.identity;
                rb.AddForce(transform.right * (reverseSpeed * (-1)));
            }

            if (rock.transform.position.x &lt; sceneLeftEdge - rockOffset) { rock.transform.rotation = Quaternion.identity; rb.AddForce(transform.right * reverseSpeed); } if (rock.transform.position.y &gt; sceneTopEdge + rockOffset)
            {
                rock.transform.rotation = Quaternion.identity;
                rb.AddForce(transform.up * (reverseSpeed * (-1)));
            }

            if (rock.transform.position.y &lt; sceneBottomEdge - rockOffset) { rock.transform.rotation = Quaternion.identity; rb.AddForce(transform.up * reverseSpeed); } } else { rockOffset = 2.0f; if (rock.transform.position.x &gt; sceneRightEdge + rockOffset)
            {
                rock.transform.position = new Vector2(sceneLeftEdge - rockOffset, rock.transform.position.y);
            }

            if (rock.transform.position.x &lt; sceneLeftEdge - rockOffset) { rock.transform.position = new Vector2(sceneRightEdge + rockOffset, rock.transform.position.y); } if (rock.transform.position.y &gt; sceneTopEdge + rockOffset)
            {
                rock.transform.position = new Vector2(rock.transform.position.x, sceneBottomEdge - rockOffset);
            }

            if (rock.transform.position.y &lt; sceneBottomEdge - rockOffset)
            {
                rock.transform.position = new Vector2(rock.transform.position.x, sceneTopEdge + rockOffset);
            }
        }
    }

    public void Destroy()
    {
        gameplay.asterodDestroyed();
        Destroy(gameObject, 0.01f);
    }

    public void DestroySilent()
    {
        Destroy(gameObject, 0.00f);
    }

}

</pre>
<p><strong>Bullet.cs</strong></p>
<pre>
/*

   .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com 

*/

using UnityEngine;

public class Bullet : MonoBehaviour
{
    void Start()
    {
        GetComponent().AddForce(transform.up * 350);
    }

    public void KillOldBullet()
    {
        Destroy(gameObject, 2.0f);
    }

    void OnCollisionEnter(Collision collisionInfo)
    {
        Destroy(gameObject, 0.0f);
    }
}

</pre>
<p>
<strong>Gameplay.cs</strong></p>
<pre>/*

   .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com 

*/

using UnityEngine;

public class Gameplay : MonoBehaviour
{

    public GameObject asteroid;
    public GameObject rocket;
    private int _startLevelAsteroidsNum;
    private bool _allAsteroidsOffScreen;
    private int levelAsteroidNum;
    private Camera mainCam;
    private int asteroidLife;

    private void Start()
    {
        asteroid.SetActive(false);
        mainCam = Camera.main;
        _startLevelAsteroidsNum = 2;
        CreateAsteroids(_startLevelAsteroidsNum);
    }

    private void Update()
    {
        RenderSettings.skybox.SetFloat("_Rotation", Time.time * 0.8f);

        if (asteroidLife &lt;= 0)
        {
            asteroidLife = 6;
            CreateAsteroids(1);
        }
        
        float sceneWidth = mainCam.orthographicSize * 2 * mainCam.aspect;
        float sceneHeight = mainCam.orthographicSize * 2;
        float sceneRightEdge = sceneWidth / 2;
        float sceneLeftEdge = sceneRightEdge * -1;
        float sceneTopEdge = sceneHeight / 2;
        float sceneBottomEdge = sceneTopEdge * -1;

        _allAsteroidsOffScreen = true;
        
    }

    private void CreateAsteroids(float asteroidsNum)
    {
        for (int i = 1; i &lt;= asteroidsNum; i++)
        {
            GameObject AsteroidClone = Instantiate(asteroid, new Vector2(Random.Range(-10, 10), 6f), transform.rotation);
            AsteroidClone.GetComponent().SetGeneration(1);
            AsteroidClone.SetActive(true);
        }
    }

    public void RocketFail()
    {
        Cursor.visible = true;
        print("GAME OVER");
    }

    public void asterodDestroyed()
    {
        asteroidLife--;
    }

    public int startLevelAsteroidsNum
    {
        get { return _startLevelAsteroidsNum; }
    }

    public bool allAsteroidsOffScreen
    {
        get { return _allAsteroidsOffScreen; }
    }

}</pre>
<hr />
<p>
<strong>Rocket.cs</strong></p>
<pre>/*

   .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com 

*/

using UnityEngine;

public class Rocket : MonoBehaviour
{
    public GameObject bullet;
    private float thrust = 6f;
    private float rotationSpeed = 180f;
    private float MaxSpeed = 4.5f;
    private Camera mainCam;
    private Rigidbody rb;

    private void Start()
    {
        mainCam = Camera.main;
        rb = GetComponent();
        bullet.SetActive(false);
    }

    private void FixedUpdate()
    {
        ControlRocket();
        CheckPosition();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0) || Input.GetKeyDown("space"))
        {
            Shoot();
        }
    }

    private void ControlRocket()
    {
        transform.Rotate(0, 0, Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime);
        rb.AddForce(transform.up * thrust * Input.GetAxis("Vertical"));
        rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -MaxSpeed, MaxSpeed), Mathf.Clamp(rb.velocity.y, -MaxSpeed, MaxSpeed));
    }

    private void CheckPosition()
    {

        float sceneWidth = mainCam.orthographicSize * 2 * mainCam.aspect;
        float sceneHeight = mainCam.orthographicSize * 2;

        float sceneRightEdge = sceneWidth / 2;
        float sceneLeftEdge = sceneRightEdge * -1;
        float sceneTopEdge = sceneHeight / 2;
        float sceneBottomEdge = sceneTopEdge * -1;

        if (transform.position.x &gt; sceneRightEdge)
        {
            transform.position = new Vector2(sceneLeftEdge, transform.position.y);
        }
        if (transform.position.x &lt; sceneLeftEdge) { transform.position = new Vector2(sceneRightEdge, transform.position.y); } if (transform.position.y &gt; sceneTopEdge)
        {
            transform.position = new Vector2(transform.position.x, sceneBottomEdge);
        }
        if (transform.position.y &lt; sceneBottomEdge)
        {
            transform.position = new Vector2(transform.position.x, sceneTopEdge);
        }
    }

    public void ResetRocket()
    {
        transform.position = new Vector2(0f, 0f);
        transform.eulerAngles = new Vector3(0, 180f, 0);
        rb.velocity = new Vector3(0f, 0f, 0f);
        rb.angularVelocity = new Vector3(0f, 0f, 0f);
    }

    void Shoot()
    {
            GameObject BulletClone = Instantiate(bullet, new Vector2(bullet.transform.position.x, bullet.transform.position.y), transform.rotation);
            BulletClone.SetActive(true);
            BulletClone.GetComponent().KillOldBullet();
            BulletClone.GetComponent().AddForce(transform.up * 350);
    }
}

</pre>
<p>The post <a rel="nofollow" href="https://oxmond.com/asteroids-arcade-gameplay/">How to Create the Iconic Asteroids Arcade Gameplay! Unity 2019 Intermediate Tutorial</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oxmond.com/asteroids-arcade-gameplay/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
