<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chris Patino on Medium]]></title>
        <description><![CDATA[Stories by Chris Patino on Medium]]></description>
        <link>https://medium.com/@christhedeveloper617?source=rss-3ad5299e8820------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*suuPtI6HyI3aGxjN3L6sNQ.jpeg</url>
            <title>Stories by Chris Patino on Medium</title>
            <link>https://medium.com/@christhedeveloper617?source=rss-3ad5299e8820------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 11:00:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@christhedeveloper617/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Day 36 || 100 Days of Unity — Creating a Different Enemy Movement]]></title>
            <link>https://medium.com/@christhedeveloper617/day-36-100-days-of-unity-creating-a-different-enemy-movement-4e32857d9b82?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e32857d9b82</guid>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[unity2d]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Tue, 11 Jul 2023 23:48:36 GMT</pubDate>
            <atom:updated>2023-07-11T23:48:36.675Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 36 || 100 Days of Unity — Creating a Different Enemy Movement</h3><p>In this article, I will be going over how to create a second enemy with different movements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*w2czHC6NqfbukYeCStRyEQ.gif" /></figure><p>To begin, I have created a fresh antagonist named “Enemy2” and incorporated all the same components as my initial enemy, excluding the script. The reason behind this is that we intend to develop a new script specifically for “Enemy2,” enabling it to move sideways instead of vertically, unlike the original enemy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuCVGyw42ZNwNog43WvnLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_H5mCPmYWlFyNIYqru97Sw.png" /></figure><p>Now, let’s focus on defining the behavior of “Enemy2.” I replicated most of the code from our enemy script, but with a modification in the “calculate movement” method to align with the desired sideways movement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rw-4u2_5_s2Pasf8GoH84w.png" /></figure><p>Next, we need to make adjustments to our Spawn Manager Script to ensure that it can spawn our newly created enemies as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IiDuKj7559blkrh8FRsdeA.png" /></figure><p>As shown earlier, we introduced a new variable called “randomEnemy” in our code. We utilize this variable within a switch statement in the Spawn Manager Script to enable random spawning of different enemy types. This implementation using a switch statement also facilitates the seamless addition of any future enemy types.</p><p>Below the switch statement, we instantiate the enemies by referencing the “randomEnemy” variable. You’ll notice that we have assigned the randomEnemy to an index that allows us to conveniently assign our enemies within the editor.</p><p>Once this step is complete, we can return to the editor and assign our respective enemy types to the Spawn Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wSD3wa5vryepewpDgblsbw.png" /></figure><p>Now, if we proceed to run the game, you will witness the newly created enemy moving horizontally as intended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*31QcU-LFg6CjSj-UpIz6jg.gif" /></figure><p>And there you have it! We have successfully crafted a new enemy that exhibits sideways movement. In the upcoming lessons, we will delve into creating even more advanced adversaries. Stay tuned for exciting developments in the following sessions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e32857d9b82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 35 || 100 Days of Unity — Dynamic Camera Shake]]></title>
            <link>https://medium.com/@christhedeveloper617/day-35-100-days-of-unity-dynamic-camera-shake-ae9c20150356?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae9c20150356</guid>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Sat, 10 Jun 2023 21:46:24 GMT</pubDate>
            <atom:updated>2023-06-10T21:46:24.231Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 35 || 100 Days of Unity — Dynamic Camera Shake</h3><p>“Elevate Your Game with Dynamic Camera Shakes: Experience the Thrill!”</p><p>Get ready for an exciting upgrade to your game! In this article, we’ll show you how to make the camera shake with every powerful hit your player takes. Brace yourself for a pulse-pounding experience that will leave you on the edge of your seat. Let’s dive in and unleash the thrill of dynamic camera shakes in your game!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*MOgdHPakBS8yJPmwmvrq5Q.gif" /></figure><p>To begin, I’ve made the decision to incorporate camera and background image movement in the shake effect. To achieve this, I’ve created an empty GameObject and set both the camera and the background image as its children. Additionally, I’ve developed a new script called ‘CameraShake’ to facilitate this functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*HIyx1xlA1Jp7729CQqZGWg.jpeg" /></figure><p>After completing the previous steps, please open the script. In this section, our main task is to create a new public Coroutine responsible for the shaking effect. I’ve designed it to be modular, allowing for the addition of shaking from other sources apart from just the player taking damage.</p><p>Inside the Coroutine, we will modify the transform.position of the entire gameObject. The position will be set to random values ranging from -1 to 1, multiplied by the specified magnitude, for the given duration. Once the shaking is finished, we will reset the position back to its original value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvF_recPkp_s9Bqw0q6s6g.png" /></figure><p>Now, let’s make a few additions to the ‘Player’ script. We will define two variables: one for the duration and another for the magnitude of the camera shake effect. Additionally, we need to create a variable that stores the reference to the ‘CameraShake’ GameObject. It’s important to perform a null check to ensure it is not empty.</p><p>After that, the only remaining task is to start the ‘Shake’ coroutine whenever the player sustains damage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mr1jigwHs9ChsgK2PUcFNA.png" /></figure><p>And with that, we’re done! Now, whenever the player takes damage, they will experience a mildly unpleasant shake, immediately notifying them of the damage inflicted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*c2ovq2E8a9Y6_UuOtpEn_g.gif" /></figure><p>This effect can motivate the player to dodge and avoid further damage, as the intensity of the camera shake will be reduced by doing so.</p><p>That wraps it up for today, folks! In our next article, get ready for a game-transforming journey as we explore exciting updates to take your game to the next level. We’ll dive into adding enemy waves, crafting an epic boss level, and much more. Stay tuned for an adventure-packed read that will supercharge your gaming experience!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae9c20150356" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 34 || 100 Days of Unity — Creating a Scaling Thruster Bar]]></title>
            <link>https://medium.com/@christhedeveloper617/day-34-100-days-of-unity-creating-a-scaling-thruster-bar-f7dc23d84625?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7dc23d84625</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[unity2d]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 20:30:30 GMT</pubDate>
            <atom:updated>2023-06-08T20:30:30.459Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 34 || 100 Days of Unity — Creating a Scaling Thruster Bar</h3><p>Currently, in our 2D Space Shooter game, our player can speed up using the thruster, but it lacks limitations which makes the game less challenging.</p><p>To address this, in today&#39;s article, we will introduce a fuel bar that depletes each time the thruster is used. This will require the player to wait for the fuel to refill before being able to use the thruster again, adding an element of strategy and challenge to the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KuEAN9hcau9G0k7DdPnDHQ.gif" /></figure><p>To begin, I searched for a suitable sprite to serve as the fuel bar indicator. After careful consideration, I selected the sprite displayed below, as it effectively depicts both the full and low fuel states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*CnOjqu8swZmm5oqQ3ZjaZw.png" /></figure><p>Now that we have the desired image for the fuel bar, let’s proceed to Unity and add it to an object within our canvas, where we have all our other UI elements. Once this is done, we will be able to see the fuel bar displayed in our game scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*kxKXdpwkt949LfgkVMjCMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z5BMgwlRPXdggOLkRidi_A.png" /></figure><p>Now that we have a visually appealing fuel bar, let’s dive into the code and make it functional. To start, within our player script, we need to create a variable for our thruster and set its initial value to 15, which represents the total charge we want to give it. I suggest using a float variable type to allow for gradual fuel depletion as we use the thruster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*BrO9vYUQ3fdfNNK6NJSVJw.png" /></figure><p>Now, if we navigate to our UI script, we need to create two variables that will hold the sprites we created for the fuel bar in the editor. These variables will allow us to dynamically update the appearance of the fuel bar based on the current fuel level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*X1g33KBweTkaKqOEWAVCEQ.png" /></figure><p>Having established these variables, we can now proceed to create the method ‘UpdateThruster()’ in our UI script. This method will be responsible for updating the fuel bar in the UI based on the current fuel level. We will call this method in our player script at a later stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*kAbZ6Ds3Ax9rXn0JCilNDQ.png" /></figure><p>Let’s return to our player script and create the method that will enable us to use the thruster only if we have remaining fuel. In technical terms, the thruster power should be above 0. We can accomplish this by using an if statement that subtracts 1.0f from our thruster power in real time (using Time.deltaTime). Additionally, we should deactivate the thruster when our _thrusterPower is less than or equal to 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5tDiDDgraU_cznPjfj1HQ.png" /></figure><p>Furthermore, you may observe that we have included a line of code to update the UI manager with the appropriate image each time we use the fuel bar. With the ThrusterActive() method now in place, we can integrate it into our CalculateMovement() method within the ‘if’ statement where we previously activated the thruster by holding down the Shift button. This will ensure that the thruster can only be utilized if there is available fuel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EVAewMUmEm4pWT0sMQjeg.png" /></figure><p>Now, if we return to Unity and run the game, we will notice that our thruster power bar gradually decreases each time we utilize the thruster. This provides us with a visual representation of the fuel consumption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENaghja-H8bgvbwqYWWSqQ.gif" /></figure><p>Next, we need to implement the method responsible for refilling our thruster fuel bar when the thrusters are not active. Let’s name this method AddFuel(). Inside this method, we will incorporate logic to check if the thruster power is less than the maximum value (15 in this case) and if the thruster is not active. If these conditions are met, the fuel bar will gradually recharge at a rate of 0.1f.</p><p>In the code below, you will also notice the inclusion of a line that updates our UI manager to reflect the current fuel level. By implementing this method, we ensure that our thruster fuel bar refills itself when the thrusters are not in use, adding an additional layer of gameplay mechanics and strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNBZxbzA_jCS6QTfbSIvLA.png" /></figure><p>Now that we have created the AddFuel() method, we can expand the if statement within the CalculateMovement() method, which controls our thruster, to include a call to the AddFuel() method when the thruster is not active. This will allow the fuel bar to replenish itself when the thrusters are not in use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*9fcvkAo4DgkK4pKhxHBKMA.png" /></figure><p>With this addition, the fuel bar will gradually refill when the thrusters are not actively being used, providing the player with the opportunity to conserve fuel and utilize it strategically.</p><p>Having incorporated the necessary logic to ensure the proper functioning of our thruster bar and implemented the code to update our user interface, the next step is to connect all the sprites associated with the thruster bar to their respective handles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eX3wfgjB2BA4abTIoB4SXQ.png" /></figure><p>With the successful placement of the required assets in their designated positions, we are now ready to execute our game and observe the full functionality of our thruster bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*OOM5KBtICiaPmxmYkTk7Uw.gif" /></figure><p>In this tutorial, we accomplished the creation of a functional fuel bar that depletes when the thruster is activated and replenishes when it’s not in use. To achieve this, we established an interaction between the player and the UI manager, following a similar approach to what we previously did when implementing the lives system, ammo system, and player score.</p><p>In the upcoming article, we will delve into the process of incorporating a camera shake feature into our game.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7dc23d84625" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 33 || 100 Days of Unity — Secondary Firing Method]]></title>
            <link>https://medium.com/@christhedeveloper617/day-33-100-days-of-unity-secondary-firing-method-3e23dd5ce89b?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e23dd5ce89b</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Wed, 07 Jun 2023 18:31:44 GMT</pubDate>
            <atom:updated>2023-06-07T18:31:44.071Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 33 || 100 Days of Unity — Secondary Firing Method</h3><p>Currently, our player possesses a single normal laser shot, and when we collect a power-up, a triple shot becomes available. However, considering the multitude of enemies we encounter, it seems necessary to introduce an additional means of destroying them all. In this article, we will explore the process of creating a secondary firing method that will be unlocked through power-ups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*i-L0nHf-_8Pv0H-xUcPiEw.gif" /></figure><p>To begin, we must import certain assets that will serve as visual representations for our fireball projectile and the power-up collectible associated with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*1OFlEimQSg2zAEKpzzRcpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/164/1*pvnmOQJlG4S7hIYipcCADA.png" /><figcaption>Fireball Powerup on left | Actual Fireball On the right</figcaption></figure><p>After importing the assets, we can proceed to attach the required components, scripts, and animations to the newly added sprites. This will allow them to exhibit behavior similar to other power-ups in the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*1NhyVv3T1odAYYRs702yCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*ZMG9c36SYsM6Dpq2p_s6cg.png" /></figure><p>With the initial UI setup complete, we can now move on to implementing the desired behavior in our code. To begin, let’s add a reference to our fireball prefab and establish a mechanism to activate it when necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*8Fjl4Pe9n9v0rrOqy-xmkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*Ij5AMrzxJAogJcwaYWuE0g.png" /></figure><p>We can now proceed with creating the function responsible for activating our Fireball when the power-up is collected. Additionally, we need to implement a power-down method that will deactivate the Fireball after a specified duration has elapsed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*t7zm02tW2Pa-Yhqyiv9gAQ.png" /></figure><p>Now, within the if statement inside our FireLaser method, we can include the ‘_isFireActive’ variable as one of the conditions to check when firing our laser. This can be done similarly to how we have handled the Triple Shot laser. If the triple shot is active, it will fire the triple shot. If the fireball is active, it will fire the fireball. Otherwise, if neither power-up is active, it will fire the normal laser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8KspdSZryVgkhAkduGm-kw.png" /></figure><p>After implementing the above changes, we can proceed to the enemy script. Here, we will enable the enemies to detect when they are hit by our fireball, resulting in their destruction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OmEHNcQRfZtEq-n99I3Bzw.png" /></figure><p>The final step is to create a script specifically for our Fireball. In this script, we will store the logic to control the activation and duration of the Fireball, specifying how long it should remain active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*rDbwqEo9BhDkTIXeC9ms1g.png" /></figure><p>Having saved our progress, we can now run the game in Unity and witness the successful collection of our new fireball power-up. We can then proceed to destroy enemies using our fireball weapon, which functions more like a flamethrower.</p><p>With the new firing method implemented, our next step will be to introduce limitations to some of the player’s existing powers, starting with the thrusters. We will explore how to restrict their usage frequency in the upcoming article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e23dd5ce89b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 32 || 100 Days of Unity — Adding Lives]]></title>
            <link>https://medium.com/@christhedeveloper617/day-32-100-days-of-unity-adding-lives-ce4cc095b3e1?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce4cc095b3e1</guid>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 20:07:45 GMT</pubDate>
            <atom:updated>2023-06-06T20:07:45.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 32 || 100 Days of Unity — Adding Lives</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0_4zXbuhXFcE65eRtPYVg.jpeg" /></figure><p>Just like we added the ammo collectible in the previous lesson, we will now follow a similar process but with a different sprite representing life. To begin, we need to include the desired sprite in our assets. Next, we will drag it into the scene and attach the required components so that it can function as a collectible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*A7MITNl1KyIVm61iMDZ25Q.png" /></figure><p>After incorporating all the necessary components, including the script, we can proceed to develop the logic. In the player script, we will begin by generating a new private GameObject. This will allow us to conveniently position our prefab in that location in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*LfoUY357Ra1N-VfC7_0JiA.png" /></figure><p>Creating a separate script for the life collectible is unnecessary since it will exhibit the same behavior as other power-ups. However, we do need to implement a function in the player script that handles adding a life when the collectible is obtained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*FPdhhbIIbRFwKCo7CBthKg.png" /></figure><p>Having established the function for adding life, we can now integrate it into our switch statement within the power-up script. This will enable us to conveniently reference and utilize it within the editor at a later stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*_Z08lIoE4-4NFJ-4hsaaVQ.png" /></figure><p>Within the “SpawnPowerupRoutine()” function of the Spawn Manager script, we should adjust the scope of the “randomPowerUp” integer to a value of 5. By implementing this change and exercising caution while modifying the code, we can minimize the need for future alterations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9m1q_YF0FEgSXLy4CiZnzQ.png" /></figure><p>Now that we have implemented the necessary code additions and modifications, we can return to Unity and run our game. In the Inspector, you should observe that when you lose a life and subsequently collect one of the newly generated life power-ups, your life count should increase. This can be visualized in the player’s Inspector tab. However, we still need to make the appropriate changes in our UI Manager so that the updated life count is visible within the game scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6zcdyn9e20ainNzVI9vQZw.gif" /></figure><p>Having successfully implemented the functionality of our life power-up, we now need to ensure that the corresponding changes are reflected in the UI. To accomplish this, let’s navigate back to our code and specifically the player script. We will begin by reintroducing the image that represents our lives each time a life power-up is collected. To achieve this, we can simply call the “UpdateLives” method that we had previously created in our UI Manager script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*aLhAfrw0WycVJRIU6p4kBg.png" /></figure><p>Continuing with the implementation of engine damage, we will proceed to the player script. In this step, we will add the same conditional statement that was used to activate the engine damage visual. However, instead of setting it to true directly, we will nest it within our newly created “AddLife” method and set the damaged engine animation to false. This will ensure that when a life is gained through the life power-up, the damaged engine animation is deactivated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*bWpv9ln356Y5oPmnnY85cQ.png" /></figure><p>Once we save the changes and return to Unity to run the game, we will observe that when we collect the life power-up, not only will our lives sprites replenish, but our engines will also be repaired simultaneously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*OQR34-aXrRGBGKUkUrTLnA.gif" /></figure><p>Congratulations! We have effectively implemented a mechanism to replenish life by collecting life power-ups that function as power-ups.</p><p>In the upcoming lesson, we will further enhance our game by introducing an additional firing method that will be accessible exclusively through another power-up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce4cc095b3e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 31 || 100 Days Of Unity —Creating a Reload System]]></title>
            <link>https://medium.com/@christhedeveloper617/day-31-100-days-of-unity-creating-a-reload-system-78d560c2653c?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/78d560c2653c</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[unity2d]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[reload]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Thu, 01 Jun 2023 16:20:40 GMT</pubDate>
            <atom:updated>2023-06-01T16:20:40.654Z</atom:updated>
            <content:encoded><![CDATA[<p>In our exhilarating 2D Space shooter game, we have mastered the art of controlling the frequency of laser shots. However, what we haven’t conquered yet is a method to replenish our precious ammo reserves. Fear not, fellow space pilots, as in this article we will delve into the secrets of ammo refills and learn how to implement them effectively. Prepare for an epic journey of ammo restoration!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*qH0Vt0Iy0O8lP5KY59SXdg.gif" /></figure><p>To begin with, I searched online and discovered an image of a bullet on OpenGameArt.org. I’ve chosen this image as the sprite for our ammo power-up, which we’ll be collecting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/1*erZBMuHsnnXQsnwZ5OVr0Q.png" /></figure><p>After downloading the image and saving it as a PNG file, we can import it into our game assets and place it in Unity. In the Unity editor, we need to select the image in the inspector and assign it as a Sprite while labeling it as a 2D texture shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*2DVTXZ_dZkvVW4xNuZagwg.png" /></figure><p>To enable future assignments, we need to create a prefab for our new ammo sprite. Additionally, we must add essential components such as Rigidbody2D, Collider, and the Powerup Script to allow player interaction. As our ammo power-up will function similarly to our existing power-ups, we can conveniently attach our power-up script to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*k8sbR11ByiSX_K7Mb_B45Q.png" /></figure><p>We are now prepared to implement the necessary code logic for interacting with the power-up and refilling our ammo upon collection. First, let’s introduce a variable called “maxAmmo” and set its value to 20, representing the maximum number of bullets we can have at any given time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*hV_H0Mkm8ZptFJsHtBjMtQ.png" /></figure><p>Next, let’s create a method that we can call later to refill our ammo and update the ammo count in the UI manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*HFw5W-7XGRsizF-8LJD2NQ.png" /></figure><p>With the creation of the ReloadAmmo method, we can now proceed to utilize it in our power-up script to give our ammo sprite the behavior of a power-up. We will add to the existing switch statement, just as we have done with other power-ups before, enabling our player to collect the ammo power-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*I8ZzzeZF1sfE9jRA2-rxsA.png" /></figure><p>To ensure that our ammo power-up receives the same spawning behavior as other power-ups, we need to make a crucial modification in our Spawn Manager script. By adjusting the spawning range from 3 to 4, we will include our new power-up within the scope of the spawning process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bP3_nMlvt1-Eg807gZzKbw.png" /></figure><p>Now, let’s return to the Unity editor and assign the correct power ID (which is 3 in this case) to our ammo power-up. Afterward, we can navigate to our Spawn Manager and add our ammo prefab as a new element to the appropriate list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFZebZdii-NuOu6dbJ46Zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Kr_B3-GG5QlkWESCgMuJiw.png" /></figure><p>If we proceed to run our game, you will now observe that the ammo power-up spawns just like the other power-ups. Once collected, your Ammo Count will reset to 20, ensuring you have a fresh supply of ammunition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*pX24wglMciaySoLerxxp_Q.gif" /></figure><p>And there you have it!</p><p>We have successfully created a power-up that refills our ammo when collected. In the next lesson, we will explore a similar concept but instead of collecting ammo, we will focus on collecting lives. This will provide us with an opportunity to prolong our survival in the game. Stay tuned for the next lesson!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78d560c2653c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 30 || 100 Days Of Unity — Creating an Ammo System]]></title>
            <link>https://medium.com/@christhedeveloper617/day-30-100-days-of-unity-creating-an-ammo-system-7cb6e5cfe3ee?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cb6e5cfe3ee</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[unity2d]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Tue, 30 May 2023 18:05:17 GMT</pubDate>
            <atom:updated>2023-05-30T18:05:17.771Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 30 || 100 Days Of Unity — Creating an Ammo System</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQsvIr6ikGGOAzdHdAKuFw.jpeg" /></figure><p>I aim to initialize the player’s ammunition count to 25 shots. Whenever the player fires, the ammunition count decreases by 1. Once the player’s ammunition is depleted, they should no longer be able to fire their weapon, and the ammunition count should remain at 0 until the player can obtain some ammunition through a randomly generated power-up. As the ammunition count decreases, there should be a visual indication that alerts the player that their ammunition level is getting critical.</p><p>Let’s begin by including a private integer variable called _ammoCount in the Player script and setting its initial value to 25.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpgsQzJtTmimvCLoup9mdw.png" /></figure><p>Next, within the PlayerFiresLaser() method, add the following code snippet at the beginning of the method. This code will verify the value of _ammoCount. The laser weapons can only be fired if _ammoCount is greater than 0 and the &quot;cooldown&quot; condition is true. If both conditions are satisfied, reduce the value of _ammoCount by 1 and invoke the UpdatePlayerAmmoStores() method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6mVlWiHDlmamLzVzu5uX1Q.png" /></figure><p>The UpdatePlayerAmmoStores() method is responsible for setting the bounds for the ammunition stores. If the value of _ammoCount becomes negative, it is reset to 0. If it exceeds 25 (which is the maximum quantity chosen for this version of the game), then _ammoCount is capped at 25. After performing these checks, the new value of _ammoCount is passed to the _uiManager through the UpdateAmmoCount(_ammoCount) method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JhugqdqttXBUtvD1U0QN7Q.png" /></figure><p>In the <strong>UIManager</strong> script, add a new private <strong>Text Mesh Pro</strong> text field to represent the <strong>Player’s</strong> ammo count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fV0tXE2Gd-Migj8lnoLyAw.png" /></figure><p>In the UIManager script, include a method called UpdateAmmoCount(int ammoCount). This method retrieves the integer value that represents the remaining ammunition held by the player. The ammoCount parameter in the UpdateAmmoCount(int ammoCount) method corresponds to the value represented by _ammoCount in the PlayerFiresLaser() method of the Player script.</p><p>By means of script communication, the ammoCount is transferred from the Player script to the UIManager script when the UpdateAmmoCount(int ammoCount) method is invoked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cBaHIkpEyasGXORfLKNlGg.png" /></figure><p>In the <strong>Canvas</strong>, duplicate the <strong>Score_text</strong>, rename it to <strong>Ammo_Count_text</strong>, change the “<em>Score: 0</em>” text to “<em>Ammo: 25</em>”, reposition it in the game scene, and set its color to bright green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*az1Btp9g7gwCb4OxO7YZ5g.png" /></figure><p>If you run your game you should now be able to see the score count, and your ammo!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cb6e5cfe3ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 29 || 100 Days of Unity — Adding a Thruster Feature]]></title>
            <link>https://medium.com/@christhedeveloper617/day-29-100-days-of-unity-adding-a-thruster-feature-d21de270d8df?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/d21de270d8df</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity-features]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Wed, 24 May 2023 23:34:42 GMT</pubDate>
            <atom:updated>2023-05-24T23:34:42.474Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 29 || 100 Days of Unity — Adding a Thruster Feature</h3><p>With the initial release of our 2D Space shooter game complete, it’s time to enhance it by incorporating additional features. Our first addition will be thrusters, allowing players to accelerate by pressing a designated button and return to normal speed upon release. Let’s strategize the implementation of this feature:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2131uAy0tA0xGBScr3X8ZQ.gif" /></figure><h4>Tasks:</h4><p>1. Implement a mechanism to increase the player’s speed when the ‘Left Shift’ key is pressed down.<br>2. Create a function that resets the player’s speed back to normal when the ‘Left Shift’ key is released.</p><p>Let’s begin by introducing a new private variable, specifically for our thrusters, which can be activated in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*tfOerqFjPjGQtF6izzqIwA.png" /></figure><p>Next, let’s create a method called `GetSpeed()`, which will contain the logic to activate the velocity boost not only from our thrusters but also from collecting the speed power-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m98DwvC9wAezupGx0_gluA.png" /></figure><p>Now that we have the new method `GetSpeed()` that handles all of our speed boosts, we can add it to our code and replace any previous variables we had for speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*6GfYZbAM2qL7c0DDYqAypQ.png" /></figure><p>Now, let’s proceed to create an if statement that contains the logic to activate our newly implemented speed thruster when the left “Shift” key is pressed and turns it off when the “Shift” key is released.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*EV96RWY1AvNPsNh2qIIr2Q.png" /></figure><p>With this code now in place, if we run our game in Unity, we will be able to observe the effect of our thrusters when we press the shift key. Although we currently lack a visual effect for the thrusters, you can visualize the change in the inspector of our player. When we press the shift key, the “thruster active” option will be checked, resulting in a noticeable speed boost in our player movement. Conversely, when we release the shift key, the option will be unchecked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v7JrPlA-LzXgUmHSSti3iQ.gif" /></figure><p>There you have it! We have successfully implemented a thruster for our player. In the near future, we can enhance the visual appeal of our game by animating the thruster, making it look even more impressive and adding to the overall coolness factor.</p><h3>Our Space Shooter Code So Far…</h3><h4>Player Script:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDe3FwuqNaXaYk_-g0FmgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9AIb0dglKrKCtqxKyDLng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lr5UP88RHK9oCXXxKtTT-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4JSUMsuO6LPLi0iKfoXaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_2YcMCFxCYktH_4dmdLCQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d21de270d8df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 28 || 100 Days of Unity — Building Your Game for WebGL on Unity]]></title>
            <link>https://medium.com/@christhedeveloper617/day-28-100-days-of-unity-building-your-game-for-webgl-on-unity-a36ff7a9bd71?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/a36ff7a9bd71</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity2d]]></category>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Sat, 20 May 2023 00:17:57 GMT</pubDate>
            <atom:updated>2023-05-20T00:17:57.737Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 28 || 100 Days of Unity — Building Your Game for WebGL on Unity</h3><p>Similar to building our game for Mac and PC, to build for WebGL, we need to access the Build Settings. Instead of selecting the default settings, we will choose the “WebGL” option from the available build options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*eW7Kq5stl1XWHTrneFtFEA.png" /></figure><p>Now, you need to switch platforms in Unity to allow for compilation and preparation of the build using WebGL. The option to switch platforms can be found at the bottom of the Build Settings menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*8vCpr0S6YQvDi_I7kwH67g.png" /></figure><p>Once you select the switch option, Unity will initiate the recompilation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*-TLBUFRVWQRVEFOfe9X38g.png" /></figure><p>After the compilation is complete, you will now be able to see the WebGL options. However, before proceeding, it is important to address the warning message regarding necessary changes to the player settings. To resolve this, open the player settings and navigate to the “Other Settings” section under the “Player” options.</p><p>In this section, modify the color space setting from “Linear” to “Gamma”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rChjjyeJSLVyssFXYpfyPQ.png" /></figure><p>After making the color space change, Unity will initiate another compilation process, enabling us to proceed with building for WebGL. When you click the build button, you will be prompted to save the build somewhere on your computer. Once the build process is complete, a folder containing the project’s components will automatically open up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*voAA_IaIf9sHnuiLBKyUCg.png" /></figure><p>These files are the ones you would upload to a hosting platform or webpage to make your work available online.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WjoB75LcbGi9kh39Utxzmw.png" /></figure><p>If you attempt to open your HTML file directly, you will encounter a specific message. In a future article, I will guide you through the process of officially launching your game once you have a server in place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a36ff7a9bd71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build and test your game in MAC/PC]]></title>
            <link>https://medium.com/@christhedeveloper617/how-to-build-and-test-your-game-in-mac-pc-61b8c4423f34?source=rss-3ad5299e8820------2</link>
            <guid isPermaLink="false">https://medium.com/p/61b8c4423f34</guid>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[2d-game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[unity2d]]></category>
            <dc:creator><![CDATA[Chris Patino]]></dc:creator>
            <pubDate>Fri, 19 May 2023 16:51:57 GMT</pubDate>
            <atom:updated>2023-05-19T16:51:57.145Z</atom:updated>
            <content:encoded><![CDATA[<p>In this guide, I will demonstrate the process of building your game for both PC and Mac platforms on Unity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*qCjk5kWULc7P9VSznZywvA.gif" /></figure><p>To begin, navigate to the “Build Settings” option located in the file menu. Upon opening the Build Settings, you will notice that the default build setting is already configured for PC, Mac &amp; Linux. The target platform should automatically reflect the computer you are currently using, and the architecture should also have a default setting assigned. If the default setting is missing, you can manually select the desired architecture option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9qrBDZspnFy1UCTZ3RtmA.png" /></figure><p>By accessing the Player Settings tab at the bottom, you can customize various aspects of your game’s data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twfrwojyIHI1w2OdXUnzSg.png" /></figure><p>After entering the desired information for your game, return to the main Build Settings menu. At the bottom, locate and click on the Build button to initiate the build process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*d731wHFLeUp3cMAfyHRugA.png" /></figure><p>It’s important to note that if you have imported assets, you may encounter errors when attempting to build. In your case, if you have assets installed from Filebase, you will need to disable them temporarily to proceed with the build. If you encounter an error, ensure that you exclude the editor and standalone options temporarily, and then try running your game again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*41HgWBHTVFy4IK8Jumyiog.png" /></figure><p>Once you have successfully built your game, a folder containing your game files will appear. Locate the folder where you saved your game, and inside it, you will find the application for the game you have just created. Open the application and start playing!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QPDj4TcG-2gIgcN1FBZqbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qk8Sv7CJg4UsipDJdkQbIw.png" /></figure><p>Now that we have covered the build settings, let’s proceed to the next step of launching our game online by deploying it through WebGL. This will be the focus of our upcoming article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61b8c4423f34" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>