<?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>green Archives - Oxmond Technology</title>
	<atom:link href="https://oxmond.com/tag/green/feed/" rel="self" type="application/rss+xml" />
	<link>https://oxmond.com</link>
	<description>IT Development</description>
	<lastBuildDate>Wed, 18 Nov 2020 04:56:44 +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>Tank Game Basics! How to build, animate and control a tank</title>
		<link>https://oxmond.com/tank-game-basics-how-to-build-animate-and-control-a-tank/</link>
					<comments>https://oxmond.com/tank-game-basics-how-to-build-animate-and-control-a-tank/#respond</comments>
		
		<dc:creator><![CDATA[Oxmond Technology]]></dc:creator>
		<pubDate>Mon, 10 Dec 2018 05:46:32 +0000</pubDate>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[2018]]></category>
		<category><![CDATA[2D]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Animator]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[coding pirates]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game making]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[lesson]]></category>
		<category><![CDATA[red]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tank]]></category>
		<category><![CDATA[tanks]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Unity3d]]></category>
		<guid isPermaLink="false">https://oxmond.com/?p=352</guid>

					<description><![CDATA[<p>Create a small tank game. Learn how to build, animate and control 2D tanks using free assets. Full C# script included. ❤️ Subscribe to Oxmond Tutorials: https://bit.ly/SubscribeOxmondTutorials ✅ Download the free Tank Constructor tool here: https://assetstore.unity.com/packages/2d/textures-materials/tank-constructor-131316?aid=1100l4p9k ✅ Other free Asset Packages at the Unity Assets...</p>
<p>The post <a rel="nofollow" href="https://oxmond.com/tank-game-basics-how-to-build-animate-and-control-a-tank/">Tank Game Basics! How to build, animate and control a tank</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Create a small tank game. Learn how to build, animate and control 2D tanks using free assets. Full C# script included.</p>
<hr />
<p><span style="font-weight: 400;"><strong>❤️ Subscribe to Oxmond Tutorials:<br />
</strong><a href="https://bit.ly/SubscribeOxmondTutorials">https://bit.ly/SubscribeOxmondTutorials</a></span></p>
<p>✅ Download the free Tank Constructor tool here:<br />
<a href="https://assetstore.unity.com/packages/2d/textures-materials/tank-constructor-131316?aid=1100l4p9k">https://assetstore.unity.com/packages/2d/textures-materials/tank-constructor-131316?aid=1100l4p9k</a></p>
<p><span style="font-weight: 400;"><strong>✅ Other free Asset Packages at the Unity Assets Store:</strong><br />
</span><a href="https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k"><span style="font-weight: 400;">https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k </span></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>Tank script:</strong></p>
<pre>/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using UnityEngine;

public class Tank : MonoBehaviour
{

    /////*******************************************/////
    /////                   VARS                    /////  
    /////*******************************************/////

    public Track trackLeft;
    public Track trackRight;

    public string keyMoveForward;
    public string keyMoveReverse;
    public string keyRotateRight;
    public string keyRotateLeft;

    bool moveForward = false;
    bool moveReverse = false;
    float moveSpeed = 0f;
    float moveSpeedReverse = 0f;
    float moveAcceleration = 0.1f;
    float moveDeceleration = 0.20f;
    float moveSpeedMax = 2.5f;

    bool rotateRight = false;
    bool rotateLeft = false;
    float rotateSpeedRight = 0f;
    float rotateSpeedLeft = 0f;
    float rotateAcceleration = 4f;
    float rotateDeceleration = 10f;
    float rotateSpeedMax = 130f;


    /////*******************************************/////
    /////                 UPDATE                    /////  
    /////*******************************************/////

    void Update()
    {

        rotateLeft = (Input.GetKeyDown(keyRotateLeft)) ? true : rotateLeft;
        rotateLeft = (Input.GetKeyUp(keyRotateLeft)) ? false : rotateLeft;
        if (rotateLeft)
        {
            rotateSpeedLeft = (rotateSpeedLeft &lt; rotateSpeedMax) ? rotateSpeedLeft + rotateAcceleration : rotateSpeedMax; } else { rotateSpeedLeft = (rotateSpeedLeft &gt; 0) ? rotateSpeedLeft - rotateDeceleration : 0;
        }
        transform.Rotate(0f, 0f, rotateSpeedLeft * Time.deltaTime);

        rotateRight = (Input.GetKeyDown(keyRotateRight)) ? true : rotateRight;
        rotateRight = (Input.GetKeyUp(keyRotateRight)) ? false : rotateRight;
        if (rotateRight)
        {
            rotateSpeedRight = (rotateSpeedRight &lt; rotateSpeedMax) ? rotateSpeedRight + rotateAcceleration : rotateSpeedMax; } else { rotateSpeedRight = (rotateSpeedRight &gt; 0) ? rotateSpeedRight - rotateDeceleration : 0;
        }
        transform.Rotate(0f, 0f, rotateSpeedRight * Time.deltaTime * -1f);

        moveForward = (Input.GetKeyDown(keyMoveForward)) ? true : moveForward;
        moveForward = (Input.GetKeyUp(keyMoveForward)) ? false : moveForward;
        if (moveForward)
        {
            moveSpeed = (moveSpeed &lt; moveSpeedMax) ? moveSpeed + moveAcceleration : moveSpeedMax; } else { moveSpeed = (moveSpeed &gt; 0) ? moveSpeed - moveDeceleration : 0;
        }
        transform.Translate(0f, moveSpeed * Time.deltaTime, 0f);

        moveReverse = (Input.GetKeyDown(keyMoveReverse)) ? true : moveReverse;
        moveReverse = (Input.GetKeyUp(keyMoveReverse)) ? false : moveReverse;
        if (moveReverse)
        {
            moveSpeedReverse = (moveSpeedReverse &lt; moveSpeedMax) ? moveSpeedReverse + moveAcceleration : moveSpeedMax; } else { moveSpeedReverse = (moveSpeedReverse &gt; 0) ? moveSpeedReverse - moveDeceleration : 0;
        }
        transform.Translate(0f, moveSpeedReverse * Time.deltaTime * -1f, 0f);

        if (moveForward | moveReverse | rotateRight | rotateLeft)
        {
            trackStart();
        }
        else
        {
            trackStop();
        }

    }

    /////*******************************************/////
    /////                METHODS                    /////  
    /////*******************************************/////

    void trackStart()
    {
        trackLeft.animator.SetBool("isMoving", true);
        trackRight.animator.SetBool("isMoving", true);
    }

    void trackStop()
    {
        trackLeft.animator.SetBool("isMoving", false);
        trackRight.animator.SetBool("isMoving", false);
    }

}


</pre>
<p><strong>Tracks script:</strong></p>
<pre>/* .-------.                             .--.    .-------.     .--.            .--.     .--.        
   |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
   |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
   |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
   © OXMOND / www.oxmond.com */

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Track : MonoBehaviour {

    public Animator animator;

}

</pre>
<p>The post <a rel="nofollow" href="https://oxmond.com/tank-game-basics-how-to-build-animate-and-control-a-tank/">Tank Game Basics! How to build, animate and control a tank</a> appeared first on <a rel="nofollow" href="https://oxmond.com">Oxmond Technology</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oxmond.com/tank-game-basics-how-to-build-animate-and-control-a-tank/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
