<?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 Emre Baskak on Medium]]></title>
        <description><![CDATA[Stories by Emre Baskak on Medium]]></description>
        <link>https://medium.com/@emrebaskak?source=rss-31c786f592a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GxylCiATkmgHnnyp</url>
            <title>Stories by Emre Baskak on Medium</title>
            <link>https://medium.com/@emrebaskak?source=rss-31c786f592a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:40:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emrebaskak/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[Letters Of Credit & Related SWIFT Messages]]></title>
            <link>https://medium.com/@emrebaskak/letters-of-credit-related-swift-messages-7d9d2211a2b3?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d9d2211a2b3</guid>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[letters-of-credit]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Sat, 18 Nov 2023 21:10:18 GMT</pubDate>
            <atom:updated>2023-11-18T21:10:18.600Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s generally see what are the methods of payments in today’s global market and then take a close look at the Letters of Credit Method.</p><h4>Methods of Payment</h4><p>To succeed in today’s global marketplace and win sales against foreign competitors, exporters must offer their customers attractive sales terms supported by the appropriate payment methods. Because getting paid in full and on time is the ultimate goal for each export sale, an appropriate payment method must be chosen carefully to minimize the payment risk while also accommodating the needs of the buyer. As shown in Figure 1, there are five primary methods of payment for international transactions. During or before contract negotiations, you should consider which method in the figure is mutually desirable for you and your customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/0*DVtmj_K75ATPNbMo" /><figcaption>Methods of Payment</figcaption></figure><p>Key Points</p><ul><li>International trade presents a spectrum of risks, which causes uncertainty over the timing of payments between the exporter (seller) and importer (foreign buyer).</li><li>For exporters, any sale is a gift until payment is received.</li><li>Therefore, exporters want to receive payment as soon as possible, preferably as soon as an order is placed or before the goods are sent to the importer.</li><li>For importers, any payment is a donation until the goods are received.</li><li>Therefore, importers want to receive the goods as soon as possible but to delay payment as long as possible, preferably until after the goods are resold to generate enough income to pay the exporter.</li></ul><h4>Cash-in-Advance</h4><p>With cash-in-advance payment terms, an exporter can avoid credit risk because payment is received before the ownership of the goods is transferred. However, requiring payment in advance is the least attractive option for the buyer, because it creates unfavorable cash flow and foreign buyers are also concerned that the goods may not be sent if payment is made in advance.</p><h4>Letters of Credit</h4><p>A Letter of Credit is a contractual commitment by the foreign buyer’s bank to pay once the exporter ships the goods and presents the required documentation to the exporter’s bank as proof.</p><p>Letters of credit (LCs) are one of the most secure instruments available to international traders. An LC is useful when reliable credit information about a foreign buyer is difficult to obtain, but the exporter is satisfied with the creditworthiness of the buyer’s foreign bank. An LC also protects the buyer since no payment obligation arises until the goods have been shipped as promised.</p><h4>Documentary Collections</h4><p>Documentary collection is so-called because the exporter receives payment from the importer in exchange for the shipping documents. Shipping documents are required for the buyer to clear the goods through customs and take delivery.</p><p>Although banks do act as facilitators for their clients, D/Cs offer no verification process and limited recourse in the event of non-payment.</p><h4>Open Account</h4><p>An open account transaction is a sale where the goods are shipped and delivered before payment is due, which in international sales is typically in 30, 60, or 90 days. Obviously, this is one of the most advantageous options to the importer in terms of cash flow and cost, but it is consequently one of the highest-risk options for an exporter.</p><h4>Consignment</h4><p>Consignment in international trade is a variation of an open account in which payment is sent to the exporter only after the goods have been sold by the foreign distributor to the end customer. In consignment, the foreign distributor receives, manages, and sells the goods for the exporter who retains title to the goods until they are sold. Clearly, exporting on consignment is very risky as the exporter is not guaranteed any payment and its goods are in a foreign country in the hands of an independent distributor or agent.</p><h3>What is a Letter of Credit?</h3><p>A Letter of Credit is a contractual commitment by the foreign buyer’s bank to pay once the exporter ships the goods and presents the required documentation to the exporter’s bank as proof.</p><p>As a trade finance tool, Letters of Credit are designed to protect both exporters and importers.</p><h3>How Does It Work?</h3><p>There are at least four parties in the L/C structure:</p><ul><li>The buyer: Applicant</li><li>The seller/supplier: Beneficiary</li><li>The buyer’s bank: Issuing bank</li><li>The seller’s bank: Advising bank</li></ul><p><strong>1)</strong> The exporter and their bank must be satisfied with the creditworthiness of the importer’s bank. Once the Sales Agreement is completed, the importer applies to their bank to open a Letter of Credit in favor of the exporter.</p><p><strong>2)</strong> The Importer’s bank drafts the Letter of Credit using the Sales Agreement terms and conditions and transmits it to the exporter’s bank. The exporter’s bank reviews and approves the Letter of Credit and sends it to the exporter.</p><p><strong>3)</strong> The exporter ships the goods in the manner provided for in the letter of credit and submits the required documents to their bank.</p><p><strong>4)</strong> The Exporter’s bank checks the documents for compliance with the Letter of Credit terms and conditions. Any document errors and discrepancies must be amended and resubmitted. After approval, the exporter’s bank submits the complying documents to the importer’s bank.</p><p><strong>5)</strong> The importer’s bank releases payment to the exporter’s bank. The importer’s account is debited and their bank releases the documents to the importer to claim the goods and clear customs.</p><p>A letter of credit, or a credit letter, is a letter from a bank guaranteeing that a buyer’s payment to a seller will be received on time and for the correct amount. If the buyer is unable to make a payment on the purchase, the bank will be required to cover the full or remaining amount of the purchase.</p><p>Due to the nature of international dealings, including factors such as distance, differing laws in each country, and difficulty in knowing each party personally, the use of letters of credit has become a very important aspect of international trade.</p><p>Letters of Credit are one of the most secure payment instruments available but can be labor-intensive and relatively expensive due to bank fees. They are recommended for use in higher-risk situations, when the importer’s credit is unacceptable or not available, when dealing with a new or less-established trade relationship, or when extended payment terms are requested.</p><p>The required documents are detailed and prone to errors and discrepancies. To avoid payment delays and extra fees, documents required by the Letter of Credit should be prepared by trained professionals.</p><h3>Types of SWIFT Messages Used in Letter of Credit</h3><p>Category 7 SWIFT messages are specifically designed for the exchange of information and instructions related to Documentary Credits and Guarantees / Standby Letters of Credit.</p><p>Messages are exchanged between banks that participate in the documentary credit and guarantee business.</p><h4>1) MT 700: Issue of a Documentary Credit</h4><p>This message is sent by the issuing bank to the advising bank.</p><p>It is used to indicate the terms and conditions of a documentary credit which has been originated by the Sender (issuing bank).</p><p>It is used when the buyer (importer) intends to establish a Letter of Credit (LC) to facilitate an international trade transaction. It provides detailed information about the LC’s terms and conditions and requests the advising bank to advise the LC to the beneficiary (seller/exporter), initiating the trade transaction under the LC terms.</p><h4>2) MT 705: Pre-Advice of a Documentary Credit</h4><p>This message is sent by the issuing bank to the advising bank. It provides advanced notice to the advising bank that a Documentary Credit (Letter of Credit) is going to be issued in favor of a specific beneficiary.</p><p>It is a brief advice for a documentary credit, the full details of which will follow.</p><p>It is used when the issuing bank wishes to provide advance notice to the beneficiary about the forthcoming issuance of a Documentary Credit (Letter of Credit). This notification allows both the advising bank and the beneficiary to prepare for the trade transaction, ultimately contributing to a smoother and more efficient international trade process.</p><h4>3) MT 707: Amendment to a Documentary Credit</h4><p>This message is sent by the issuing bank to the advising bank.</p><p>It may also be sent by an advising bank to another advising bank or by a transferring bank to an advising bank.</p><p>It is used to inform the Receiver about amendments to the terms and conditions of a documentary credit issued by the Sender or by a third bank.</p><h4>4) MT 730: Acknowledgment</h4><p>This message is used to acknowledge receipt of any documentary credit message. When applicable, it may also explicitly indicate that the message has been forwarded accord­ing to instructions.</p><p>This message type may also be used:</p><ul><li>To account for bank charges</li><li>To advise of acceptance or rejec­tion of an amendment of a credit.</li></ul><p>It helps ensure transparency and effective communication in the LC process.</p><p>When an amendment to a documentary credit is proposed, the beneficiary or advising bank may send an MT707 to request changes. The issuing bank can respond using an MT730 to advise whether the amendment has been accepted or rejected.</p><h4>5) MT 740: Authorization to Reimburse</h4><p>This message is sent by the issuing bank to the reimbursing bank.</p><p>It is used when a bank has made a payment under a Letter of Credit (LC) or a similar financial instrument and needs authorization from the issuing bank to be reimbursed for the payment. It helps ensure that payments are made in accordance with the terms and conditions of the LC.</p><h4>6) MT 747: Amendment to an Authorization to Reimburse</h4><p>This message is sent by the bank that has issued an authorization to reimburse (issuing bank) to the reimbursing bank.</p><p>It is used to inform the Receiver about amendments to the terms and conditions of the credit relevant to the authorization to reimburse.</p><p>The amendment is to be considered as part of the authorization to reimburse.</p><h4>7) MT 760: Guarantee</h4><p>This message is sent between banks involved in the issuance of a guarantee.</p><p>It is used to issue a guarantee or to request the Receiver to issue a guarantee.</p><h4>8) MT 767: Guarantee Amendment</h4><p>This message is sent by a bank that has issued a guarantee to the bank to which the guarantee was issued. It may also be sent by a bank that has requested the issuance of a guarantee to the bank to which the request for a guaran­tee was sent.</p><p>It is used to amend or request the amendment of the guarantee.</p><h4>9) MT 768: Acknowledgment of a Guarantee Message</h4><p>This message type is sent by a bank that has received a guaran­tee to the bank that issued the guarantee or an amendment thereto. It may also be sent by a bank that has been requested to issue a guarantee to the bank which requested the guarantee or an amendment thereto.</p><p>It is used to acknowledge receipt of any message relating to a guaran­tee and, where applicable, to indi­cate that action has been taken according to the instructions.</p><h4>10) MT 799: Free Format Message</h4><p>Free format messages for LC which is not covered in any of the 10xx series.</p><p>It is used as a preliminary communication tool to initiate discussions, confirm intentions, and provide assurance in LC-related transactions.</p><p><strong>SOURCES:<br></strong><em>…and more info can be found at:</em></p><p>Methods of Payments<br>International Trade Administration, US Department of Commerce <br>(<a href="https://www.trade.gov/letter-credit#:~:text=A%20Letter%20of%20Credit%20is,protect%20both%20exporters%20and%20importers.">Click here</a>)</p><p>Oracle Flexcube Universal Banking Letters of Credit User Guide (ch2, ch18)<br>Oracle Help Center<br>(<a href="https://docs.oracle.com/cd/E99083_01/html/LC/LCTOC.htm">Click here</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d9d2211a2b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Annual Bonus Report With Tableau]]></title>
            <link>https://medium.com/@emrebaskak/annual-bonus-report-with-tableau-84182f58d3b6?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/84182f58d3b6</guid>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[csv]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[report]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 16:19:01 GMT</pubDate>
            <atom:updated>2023-09-26T16:19:01.948Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Business Problem:</strong></p><p>It’s the end of the financial year for a store that operates in three regions. <br>Since it is the end of the financial year, it is time for annual bonuses.</p><p>Only the <strong>top-performing</strong> employee in each region qualifies for the bonus.</p><p>I’ll find out which three employees are eligible to get bonuses for this year.</p><p><em>P.S. Employees are measured on the total number or total value of sales.</em></p><p>We are provided a CSV (comma-separated-values) file by the business. CSV file holds the data of order date, region, representative name, item that is sold, number of units sold, and unit price.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkwB9YxeJiUHX9_4nZEfVQ.png" /><figcaption>Provided CSV file by the store</figcaption></figure><p>It is doable to calculate it manually if you have a lot of time of course!</p><p>Since we have Tableau, why should we waste any of our precious time?</p><p>I opened Tableau and uploaded the provided CSV file. It seemed reasonable to me that a bar chart would do fine in this report. I calculated the amount of total sales (in $) as Total Sales and placed it as a row. Then I selected and placed region and representative dimensions respectively as columns so they are first categorized by the region and then the representatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H4gfGNCHl4CqtTtRBnSJEQ.png" /><figcaption>Selected columns and rows in Tableau</figcaption></figure><p>Then, I played with the colors and labels. And finally, I came up with the following report.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wRr-XXiu8EGimFoZlT_yLQ.png" /><figcaption>Annual Bonus Report</figcaption></figure><p>As it appears in the Annual Bonus Report, Matthew from the Central region, Susan from the East region, and James from the West region get annual bonuses.</p><p>It took me about 5 minutes to prepare the Annual Bonus Report. If you like to learn how to do it, check the bonus section ;)</p><p><strong>BONUS:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FHeQ5VNZ8Pqo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHeQ5VNZ8Pqo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FHeQ5VNZ8Pqo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3f4a1423131b2b649d54de3888dadd2/href">https://medium.com/media/d3f4a1423131b2b649d54de3888dadd2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84182f58d3b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Tableau Map]]></title>
            <link>https://medium.com/@emrebaskak/my-first-tableau-map-1bc1bb29d41e?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bc1bb29d41e</guid>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-storytelling]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 23:21:47 GMT</pubDate>
            <atom:updated>2023-09-05T23:21:47.203Z</atom:updated>
            <content:encoded><![CDATA[<p>I found an Excel document that contains a list of transactions of a store that occurred in 2015. Every single transaction that happened in 2015 can be seen in that document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJNAQtynQCtKGXI4JN9Ggg.png" /><figcaption>Image of the Excel Document That Contains The List of Transactions</figcaption></figure><p>The data in the Excel document is very detailed! As you can see in the image above columns contain super-important data related to each transaction such as discount, unit, price, cost, product base margin, profit, country, state or province, etc. The list goes on!</p><p>There are also 1953 rows, combined with a lot of columns…The dataset is massive!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*EmyAyjAW-XoHVnpvN7b-Gg.gif" /><figcaption>The dataset is massive!</figcaption></figure><p>What if I want to see the most and the least profitable states according to this massive dataset? Am I going to go over all the rows, sort them by state, and calculate the total profit for each state? Hell no! That would take ages!</p><p>And what if I want to present my results to my team or stakeholders? Will I show them numbers written on paper? Hell no! That would be way boring!</p><p>What am I going to do then? I don’t have much time to go through all the data in the above-mentioned Excel document. I have to present the most and the least profitable states in a short period of time. Additionally, I don’t want my presentation (or the results I found) to seem boring! I want them to be catchy and easy to read/understand.</p><p>The solution comes along: Tableau!</p><p>It is an interactive data visualization tool that helps people see and understand the data. With Tableau you can create charts, graphs, maps, and dashboards that help make data-based business decisions.</p><p>Please check the official page of Tableau:</p><p><a href="https://www.tableau.com/">Business Intelligence and Analytics Software | Tableau</a></p><p>With just a few clicks I was able to visualize my dataset and create a visualization of the most and the least profitable states!</p><p>With Tableau I created a map that shows each state in different colors with its profit written on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQU1690yVVYfnKnjY2nqTQ.png" /><figcaption>The Map shows each state in different colors with its profit written on!</figcaption></figure><p>It turns out that California was the most profitable state with $37,422:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiuKEyv99D3ydYwdZl0eFw.png" /><figcaption>California was the most profitable state!</figcaption></figure><p>And sadly, North Carolina was the least profitable state with $-19,428…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KoYBV3hulJ-kP4Y5KHa-A.png" /><figcaption>North Carolina was the least profitable state…</figcaption></figure><p>It took me less than a minute to come up with the conclusion I wanted, so I want to deep dive into Tableau and learn about it more! <br>It saves a lot of time, totally worth it! ;)</p><p><strong>BONUS</strong>: What is Tableau? | A Tableau Overview</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYfE9jBq002s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYfE9jBq002s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYfE9jBq002s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/57f8435d19351016c1607ffd531c8b2d/href">https://medium.com/media/57f8435d19351016c1607ffd531c8b2d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bc1bb29d41e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shop Panel Animation with DOTween]]></title>
            <link>https://medium.com/@emrebaskak/shop-panel-animation-with-dotween-5057c16ebefe?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5057c16ebefe</guid>
            <category><![CDATA[dotween]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[csharp-programming]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Tue, 10 Jan 2023 10:35:54 GMT</pubDate>
            <atom:updated>2023-01-10T10:35:54.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwjWt6v1jOIiOb4bge2uYg.png" /><figcaption>Shop Panel</figcaption></figure><p>This is a simple shop menu I created using DOTween library.</p><p>I used DOAnchorPos(), SetEase() and DOFade() functions of the DOTween library for the animations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*o9SZejW4A6_AW0VSLuxcQQ.gif" /><figcaption>Shop Panel animation created with DOTween</figcaption></figure><p>Please check the script below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17978de8c4dafa6e8276b5adc1423a15/href">https://medium.com/media/17978de8c4dafa6e8276b5adc1423a15/href</a></iframe><p>There are 3 basic functions running in this code:</p><ul><li><strong>PanelFadeIn():</strong> It helps menu to appear on the screen</li><li><strong>PanelFadeOut():</strong> It helps menu to disappear on the screen</li><li><strong>ItemsAnimation():</strong> It helps menu items to appear on the menu</li></ul><p>Let’s take a closer look at them:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70fe27d6f8987f8dadabbfeaf3bd7447/href">https://medium.com/media/70fe27d6f8987f8dadabbfeaf3bd7447/href</a></iframe><p>Our Shop Panel in unity has a Canvas Group component. So we can use its Alpha field which is used to control the transparency of the UI elements in Canvas Group.</p><p>So, when we set the Alpha to zero, we basically make the Shop Panel invisible.</p><p>Later, we set the local position’s Y axis to -1000, so the Shop Panel is located -1000 units along the Y axis, which is above the screen. Then we call DOAnchorPos function and set the target position to 0,0. This places the Shop Panel in the center of the screen.</p><p>DOAnchorPos function moves Shop Panel downward animatedly to reach the target position.</p><p>The “false” parameter in DOAnchorPos function is the snapping parameter.</p><p>When you call the DOAnchorPos function, you can pass in a boolean value as the last parameter which determines whether the tween will “snap” to the target value or not. “Snapping” means that the tweened value will be immediately set to the target value, without any animation.</p><p>In this line of code, “false” is passed in as the last parameter, which means the rectTransform object will not “snap” to the target position, instead it will move to the target position over time based on the time set in the “fadeTime” variable with the animation effect.</p><p>With SetEase(Ease.OutElastic) function the animation starts fast, then slows down as it approaches the end, as if an elastic band is pulling the object. The motion appears to be elastic and stretches outwards before coming back to its starting position.</p><p>Then we use DOFade function to animate the alpha property of the Shop Panel. Initially, the alpha value of the canvasGroup object is set to 0, and then, using the “DOFade” function, the alpha value is animated over time to reach the value 1. The “fadeTime” variable is used to control the duration of the animation.</p><p>P.S. The PanelFadeOut() function is be the opposite of of PanelFadeIn() function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d74500b0a84de7b694173924082f2ff1/href">https://medium.com/media/d74500b0a84de7b694173924082f2ff1/href</a></iframe><p>Here, with foreach() function we reach each item in the items list we created. Firstly, we set the local scale of each item to Vector3.zero.</p><p>Vector3.zero is a pre-defined constant in Unity that corresponds to a Vector3 value of (0,0,0). Setting the localScale of an object to Vector3.zero means setting the scale of the object to 0 along all three axes, effectively making the object’s size 0 in all directions, which in turn can make the object invisible.</p><p>Then with DOScale function, we set the localScale property of each item to 1 over a duration of fadeTime and with a bouncy animation effect provided by Ease.OutBounce.</p><p>The reason we used IEnumerator is that we want each item to appear on the screen respectively, not all at the same time. You can see, in PanelFadeIn() function, we call ItemsAnimation in StartCourutine method to run it asynchronously while the main thread continues to execute.</p><p>Reference:</p><p>Pro UI Animation using DoTween simple codes — Unity Engine Tutorial</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPsFarJG4IrU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPsFarJG4IrU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPsFarJG4IrU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/99a87a991bc620721af3218eda962d3c/href">https://medium.com/media/99a87a991bc620721af3218eda962d3c/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5057c16ebefe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DOTween Animation Engine]]></title>
            <link>https://medium.com/@emrebaskak/dotween-animation-engine-2dcfe759df17?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dcfe759df17</guid>
            <category><![CDATA[dotween]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Fri, 06 Jan 2023 13:48:28 GMT</pubDate>
            <atom:updated>2023-01-06T13:48:28.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPbKguwuDwqrhcpk-_hNWA.jpeg" /><figcaption>DOTween Animation Engine</figcaption></figure><p><strong>Tweening</strong> refers to the process of smoothly interpolating (or changing) between two values over a certain period of time. So basically, a <strong>tween</strong> is an animation that smoothly changes a value over a gicen period of time. For example, a tween might be used to smoothly move and object from one position to the another, or to smoothly change the color of an object over time.</p><p>So, <strong>DOTween</strong> is a tweening library. It is a tool that helps developers to easily create and manage smooth animations and transitions in Unity. It makes it easy to create and manage tweens in Unity. It has a variety of methods for creating and manipulating tweens, as well as tools for managing and controlling them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*i8ogw0oUbW9O6QV-Zkhujw.gif" /><figcaption>DOTWeen Animations</figcaption></figure><p>DOTween is designed to be easy to use. It includes a simple, intuitive API that helps you create and manipulate tweens with just a few lines of code. It also has different methods and features so that you can easily create complex, and interconnected animations.</p><p>With DOTween you can create a wide variety of properties, including positions, rotations, scales, colors, the volume of audio sources, and more.</p><p>It allows you to specify two values (for example, the starting and ending positions of an object) and the duration of the transition, and it will automatically calculate and perform the animation for you.</p><p>Before we start, please take a look at DOTween’s official page:</p><p><a href="http://dotween.demigiant.com/getstarted.php">DOTween - Get Started</a></p><p>In this blog, I’ll be explaining some of the methods that is commonly used in DOTween library and I’ll give examples of them.</p><p><strong>1- Animating an object’s position:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c4d56146d8c153c9b527c3016a8230a/href">https://medium.com/media/8c4d56146d8c153c9b527c3016a8230a/href</a></iframe><p><strong>2- Animating object’s rotation:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4df098b31b44e8909e9663c3224938f1/href">https://medium.com/media/4df098b31b44e8909e9663c3224938f1/href</a></iframe><p><strong>3- Animating an object’s scale:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddb282b45afe82e7a5a8a024e33ece43/href">https://medium.com/media/ddb282b45afe82e7a5a8a024e33ece43/href</a></iframe><p><strong>4- Animating the color of an object:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fa0c312df1baf02ca88057302cf51cf/href">https://medium.com/media/7fa0c312df1baf02ca88057302cf51cf/href</a></iframe><p>P.S. Material component is not a child of Renderer component. However, Renderer component does have a ‘material’ property which is type of a Material. This property refers to the material that is used to render the object that Renderer component is attached to.</p><p>In the example, renderer.material is used to refer to the Material component that is being used to render the object. The DOColor method then allows you to animate the color of the material over time.</p><p><strong>5- Animating multiple properties at the same time:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0037f96624dc8aa0ab8fec7080da0272/href">https://medium.com/media/0037f96624dc8aa0ab8fec7080da0272/href</a></iframe><p><strong>6- Chaining tweens together:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/918b786c180c57f6c7b3372090c4a9a9/href">https://medium.com/media/918b786c180c57f6c7b3372090c4a9a9/href</a></iframe><p><strong>7- Looping tweens:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1804229ae68b3045e854b95e47bdb432/href">https://medium.com/media/1804229ae68b3045e854b95e47bdb432/href</a></iframe><p>Loop.Yoyo and Loop.Type are two options for the loop behavior of a tween:</p><p>- When tween is set to loop using LoopType.Yoyo, it will play through the end, then reverse and play backwards to the start, and then repeat this process indefinitely.</p><p>- When a tween is set to loop using LoopType.Restart, it will simply play from the start to the end repeatedly.</p><p><strong>8- Easing</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4a440cce5264052291af81a0bda816e/href">https://medium.com/media/c4a440cce5264052291af81a0bda816e/href</a></iframe><p><strong>9 — Delays</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2663bbdd880f254615b834874d9ddd80/href">https://medium.com/media/2663bbdd880f254615b834874d9ddd80/href</a></iframe><p><strong>10 — Callbacks</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a3cfe66c7e29ffd00150d2fa6d84a0b/href">https://medium.com/media/2a3cfe66c7e29ffd00150d2fa6d84a0b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dcfe759df17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3D Escape Game: Rocket Escape]]></title>
            <link>https://medium.com/@emrebaskak/3d-escape-game-rocket-escape-e166ce58ba81?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e166ce58ba81</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[3d-games]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 19:19:54 GMT</pubDate>
            <atom:updated>2023-01-03T19:19:54.212Z</atom:updated>
            <content:encoded><![CDATA[<p>Game no 7: Rocket Escape!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*llb3WKK0HJLoPXSRpRlWLQ.png" /><figcaption>3D Escape Game: Rocket Escape</figcaption></figure><p>Please click the link below to play the game on the web:</p><p><a href="https://sharemygame.com/@EmreBaskak/rocket-escape">Play Rocket Escape in your Browser | ShareMyGame</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/1*bY_-DNz4LbMdOqrqVdQfyg.gif" /><figcaption>3D Escape Game: Rocket Escape</figcaption></figure><p>Rocket Escape is a 3D game that I created using #unity and C#.</p><p>The goal is to move the rocket from the launching pad to the landing pad. While flying in space, you should avoid touching any obstacles on the way. Press Space to launch, and rotate your rocket with the right and left arrow keys.</p><p>I’ll be writing some of the key methods and game mechanics that I learned to create this game.</p><p><strong>Input.GetKey()</strong></p><p>There are two ways we can use Input.GetKey() method. Please check the codes below and realize the difference. Keep in mind that both of these codes do the same job.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38933c35cda2d1cbf3bfaf8430efbd63/href">https://medium.com/media/38933c35cda2d1cbf3bfaf8430efbd63/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89aa478fb8c55ddbb36f2f5010bb80e1/href">https://medium.com/media/89aa478fb8c55ddbb36f2f5010bb80e1/href</a></iframe><p><strong>AddRelativeForce()</strong></p><p>It is used to add a force to the Rigidbody in the direction specified by the function’s parameters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76ea4625f8babc86557aac0a281c6f21/href">https://medium.com/media/76ea4625f8babc86557aac0a281c6f21/href</a></iframe><p>P.S. Vector3.up is an equivalent of 0, 1, 0 that moves out the object on the y-axis.</p><p><strong>Catching A Reference To A Component</strong></p><p>When we want to control any component of an object through a script, we need to catch a reference to that specific component in that script.</p><p>Let’s say that I want to turn on the Gravity in Rigidbody component when the player presses the Space button on the keyboard.</p><p>First of all, I declare a Rigidbody variable. Then, I catch a reference to that variable in the Start() function, so that we can use that variable from the moment game starts. And finally, when the desired conditions are met, we can turn on gravity.</p><p>P.S. Gravity field in Rigidbody seems as “Use Gravity”. When we use that field in our script, we use it as useGravity. Please check the code below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/78b495f4b5d69b1c30a7ea0818f8750a/href">https://medium.com/media/78b495f4b5d69b1c30a7ea0818f8750a/href</a></iframe><p><strong>Drag Field in Rigidbody</strong></p><p>The drag force acts opposite to the direction of object’s movement. In Unity, it determines how much the object resists movement due to air resistance and friction. So, it slows down the object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/baa5a47ba9ac9e8643b609189bafd998/href">https://medium.com/media/baa5a47ba9ac9e8643b609189bafd998/href</a></iframe><p>In our game, I applied 0.25 drag force to the rocket to give a realistic feeling as the rocket moves through the air.</p><p><strong>isPlaying</strong></p><p>It is a property that returns a boolean value that shows whether the game is currently being played or not.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1119877774d7cb3e7a4921923d1df3/href">https://medium.com/media/bf1119877774d7cb3e7a4921923d1df3/href</a></iframe><p>We can also use isPlaying property to check if a sound clip is being played or not. For example, the code below plays the audio if it isn’t already being played.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4009ba2dbf769c2a40aba7aa3f6855da/href">https://medium.com/media/4009ba2dbf769c2a40aba7aa3f6855da/href</a></iframe><p><strong>Switch Statements</strong></p><p>Switch statements are like If/Else conditionals. You can use them when you want to compare a single variable to a series of constants. In other words, they help us to choose from a number of different actions based on the value of a given expression.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/216350286d344a7cbc4492c22d44a12f/href">https://medium.com/media/216350286d344a7cbc4492c22d44a12f/href</a></iframe><p>If the value of playerHealth doesn’t match any of the case values, the code in the “default” block will be executed.</p><p><strong>Reloading A Scene</strong></p><p>To reload a scene, we need to use SceneManagement namespace’s SceneManager.LoadScene() method. Inside the paranthesis we can either write the index of the scene or the name of the scene as a string.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fdd8fb1921ac2a952850b1c21e2d199/href">https://medium.com/media/3fdd8fb1921ac2a952850b1c21e2d199/href</a></iframe><p>Let’s say that our game has thousands of scenes and if the player dies, he has to start on that exact level. In this scenario, we need to reload the level in that exact scene. To do that we can use SceneManager.GetActiveScene().buildIndex method which returns the index of the current scene.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c6d1bd70d4cad3ed4b65aa7a4be48f9/href">https://medium.com/media/2c6d1bd70d4cad3ed4b65aa7a4be48f9/href</a></iframe><p>For better readability we can write the same code as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d746ca09d0d408a32cdbfd91ae5ed18/href">https://medium.com/media/9d746ca09d0d408a32cdbfd91ae5ed18/href</a></iframe><p><strong>Loading The Next Scene</strong></p><p>When we complete a level, we need to jump on to the next level. Which is very easy to do.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1424770001e7abcd1dbe91998aed3e92/href">https://medium.com/media/1424770001e7abcd1dbe91998aed3e92/href</a></iframe><p>P.S. SceneManager.sceneCountInBuildSettings returns the number of total scenes here.</p><p><strong>Invoke()</strong></p><p>When we complete a level, it would be better to wait for a little bit before we pass to another level. For that, we can use Invoke() method.</p><p>In the parentheses, first, you write the name of the method you want to the delta in quotation marks, then next to it, you write the delay time in seconds.</p><p><strong>Difference Between AudioSource.Play() and AudioSource.PlayOneShot()</strong></p><p>With AudioSource.PlayOneShot() we can specify which audio clip we want to play.</p><p><strong>How to Quit The Game</strong></p><p>To quit the game, you can use Application.Quit() method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/719fd8efcb5a5c04fbfeb6f0fb4ba6e0/href">https://medium.com/media/719fd8efcb5a5c04fbfeb6f0fb4ba6e0/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e166ce58ba81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3D Obstacles Game: Avoidant Brick!]]></title>
            <link>https://medium.com/@emrebaskak/3d-obstacles-game-avoidant-brick-c243d85d0408?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c243d85d0408</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[3d-games]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Wed, 28 Dec 2022 10:04:12 GMT</pubDate>
            <atom:updated>2022-12-28T10:04:12.666Z</atom:updated>
            <content:encoded><![CDATA[<p>Game no 6: Avoidant Brick!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*da6LrhYEzCEkAtoawwru5A.png" /><figcaption>Obstacle Game: Avoidant Brick!</figcaption></figure><p>It is a very simple 3D game that I created with Unity and C#.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*InOoVl4Z0RyOt-PfZ3ScEQ.gif" /><figcaption>Obstacle Game: Avoidant Brick!</figcaption></figure><p>The goal is to move the red brick from the down-left corner to the top-right corner of the maze while trying not to touch any of the obstacles. Obstacles are:</p><ul><li>stable,</li><li>spinning,</li><li>falling from the sky,</li><li>rolling down from the side walls.</li></ul><p>The obstacles that are touched turn red.</p><p>I’ll be writing some of the key methods and game mechanics that I learned to create this game.</p><p><strong>Frame</strong></p><p>A frame is a screen update. In other words, it is a single iteration of the game loop.</p><p>P.S. Number of the frames that are iterated per second is called FPS. A higher FPS means that the game is more responsive and has a smoother appearance.</p><p><strong>Start() and Update() Functions</strong></p><p>Start() function is called when the script is first loaded. The statements that are written in Start() will be done when the script is loaded and only once.</p><p>Update() function is called per frame. The statements that are written in Update() will be done once for every single frame.</p><p>For example, check the code below:</p><p>transform.Translate(1,0,0);</p><p>If you write the following code to your Start() function, your object will move 1 unit on x-axis for once. However, if you write the same code in your Update() function, the object will move 1 unit on x-axis for each frame. If your game’s frame rate is 30FPS, then in one second your object will move 30 units each second.</p><p><strong>Changing the Object’s Color</strong></p><p>When you add your object, it comes with a gray default color. To change the color of your object, create a Material in your asset and drag it to the Inspector of your object. It will be added as a component. Then, in your Material component, you can change the color of your object.</p><p><strong>Using Input System</strong></p><p>To control our object with the keyboard, we use Input System. Please check the code below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e271854a0221591b7377dec32bec7359/href">https://medium.com/media/e271854a0221591b7377dec32bec7359/href</a></iframe><p>I already explained Input System in my Delivery Game: Speedy Kebab article. Please click here to read about it.</p><p><a href="https://medium.com/@emrebaskak/delivery-game-speedy-kebab-5bef2d3a3110">Delivery Game: Speedy Kebab</a></p><p><strong>Changing Object’s Color In Script</strong></p><p>We are moving our Brick in the playground. And it touches the walls around, we want the walls to turn red. For that, we can basically use OnCollisionEnter() method. Please check the code below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/522b3655dcea28ff8ce4277ac40e0cb0/href">https://medium.com/media/522b3655dcea28ff8ce4277ac40e0cb0/href</a></iframe><p>This code is written in a script that is placed in Wall objects. So, when there is a collision, the code will reach the object’s Mesh Renderer component and change the object’s color.</p><p><strong>Time.time</strong></p><p>It is the real-time in seconds since the start of the game.</p><p>Let’s say that we want to print in the console how much time is passing since the start of the game. Then, we can use Time.time in our Update() function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51e7c2d9720dcbc062c62edb26cc6082/href">https://medium.com/media/51e7c2d9720dcbc062c62edb26cc6082/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c243d85d0408" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Space Shooter Game: Protect The Earth]]></title>
            <link>https://medium.com/@emrebaskak/space-shooter-game-protect-the-earth-77fb99a864c9?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/77fb99a864c9</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[2d-games]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 16:20:01 GMT</pubDate>
            <atom:updated>2022-12-24T16:21:47.719Z</atom:updated>
            <content:encoded><![CDATA[<p>Game no 5: Space Shooter!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*GVf-pK5uzlSXsqt5i9yJdg.png" /><figcaption>Space Shooter Game: Protect The Earth</figcaption></figure><p>Please click the link below to play the game on the web:</p><p><a href="https://sharemygame.com/@EmreBaskak/space-shooter">Play Space Shooter in your Browser | ShareMyGame</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/153/1*OP-HDlBqOoHMRLg-rhdv7g.gif" /><figcaption>Space Shooter Game: Protect The Earth</figcaption></figure><p>It is a 2D space shooter game that I created with Unity and C#.</p><p>You basically try to save the earth from enemies while trying to stay alive. Different enemies are coming with different waves. For each enemy you kill, you get points.</p><p>I’ll be writing some of the key methods and game mechanics that I learned to create this game.</p><p><strong>Viewport</strong></p><p>It represents a normalized position relative to the camera. The bottom left of the viewport is taken as (0,0) and the top right corner is taken as (1,1).</p><p>P.S. ViewportToWorldPoint helps us to transform an x-y screen position to an x-y-z screen position in 3D world space.</p><p>That help us so set boundaries for our player so that he cannot move out of the screen.</p><p><strong>Enemy Paths</strong></p><p>Enemies come as waves following a path. We can simply create a game object named Path, and we can create other game objects in Path to set what points our enemies will be passing on.</p><p>You can Prefab your path to reuse them, and also create scriptable objects in your Prefab.</p><p><strong>Instantiate()</strong></p><p>It clones an object and returns its clone. In this game, it was used to instantiate the enemies.</p><p>Instantiate(prefab, new Vector3(0,0,0), Quaternion.Euler(0,0,0));</p><p>In the code above the clone of the prefab object will be added to the scene at the position of Vector3 and it will have the rotation of Quaternion.</p><p>P.S. Don’t forget to use Coroutine while you are instantiating your enemies. Otherwise, your enemies will be placed right in the same position, and they will move together. So, they’ll seem like only one object.</p><p>P.S. If you want to create infinite enemy waves, you can use do-while loop.</p><p><strong>Screen Shake</strong></p><p>When the player gets hit by enemies, a screen shake can give a better feeling of the damage. Of course, we can do that by using our camera. We just change its position within a frame randomly.</p><p><strong>Scrolling Background</strong></p><p>Scrolling the background gives a sense of depth to your game. Usually, that is done with 2 layers of the background, more layers increase the sense of depth, both of them sliding down but one is a bit faster than the other.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77fb99a864c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Platform Game: Super Ginger]]></title>
            <link>https://medium.com/@emrebaskak/platform-game-super-ginger-e4181771fe?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4181771fe</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[2d-games]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 16:15:44 GMT</pubDate>
            <atom:updated>2022-12-26T13:29:45.251Z</atom:updated>
            <content:encoded><![CDATA[<p>Game no 4: Super Ginger!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69Qcwq1pafs3Y0rWuyCPPg.png" /><figcaption>Platform Game: Super Ginger</figcaption></figure><p>To play the game on the web, please click the link below:</p><p><a href="https://sharemygame.com/@EmreBaskak/super-ginger">Play Super Ginger in your Browser | ShareMyGame</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*NI3oe4b99lXwmH7xMtyWTw.gif" /><figcaption>Platform Game: Super Ginger</figcaption></figure><p>It is a Super Mario like 2D game that I created with Unity and C#.</p><p>The game has 3 levels. Our player can run, jump over obstacles or shoot aliens while trying to collect as many coins as he can!</p><p>Each coin is worth 100 points!</p><p>If the player falls on thorns, touches aliens, or drops in the water he dies! So, you better be careful because the player has only 3 lives!</p><p>I’ll be writing some of the key methods and game mechanics that I learned to create this game.</p><p><strong>Slicing Sprite Sheets</strong></p><p>Click on the sprite sheet, change Sprite Mode to Multiple, and do not forget to Apply it.</p><p>Open Sprite Editor, and you’ll see a Slice option at the top left corner of the editor. Click on it, select the Type field to be Automatic, click on Slice, and click on Apply.</p><p><strong>Tilemap</strong></p><p>Right click on Hierarchy, hover over 2D Object, and then Tilemap, select Rectangular.</p><p>It is better to create a Tiles folder in your Assets to store tiles there.</p><p>Click on Window, hover over 2D, and select Tile Palette. Then, click on Create New Palette. Save it to the Tiles folder.</p><p>Select all your already sliced sprites and rag them into your Tilemap.</p><p>P.S. For each layer you create (that could be background, platform, hazards, etc.), you should right click on your Tilemap Grid folder and create another Tilemap. So that you can decide later on which layers can interact with each other. Also, if you need to do a specific change on a layer, you wouldn’t be affecting the others.</p><p>Let’s say that you created two Tilemaps as Background and Platform. Click on the Tilemap, and you’ll see a Layer field on the top right corner of the Inspector which is set as Default.</p><p>Click on Add Layer to arrange Sorting Layers and Layers.</p><p>P.S. Sorting Layers help you to display some objects in front of other objects. Layers help you to group certain game objects together to organize the game better.</p><p>Under the Tilemap Renderer component, find Additional Settings, and change the Sorting Layer field to be the specific layer you decided on earlier.</p><p><strong>Rule Tiles</strong></p><p>Rule Tiles help you to create Tilemaps easily.</p><p>Open the Package Manager and install 2D Tilemap Extras.</p><p>Right click on your Assets folder, hover over respectively Create, 2D, Tiles, and select Rule Tile.</p><p>Click on Rule Tile, set your Default Sprite, and start creating Tiling Rules.</p><p>P.S. In Tiling Rules, you will see an Output field. You can click on it to set your sprites placed randomly according to the rule you set. Let’s say that you have 5 different grass sprites. Some of them have longer some of them have shorter grass on them, and you want to place them randomly. When you change the Output field to be Random in Tiling Rules, you can type 5 to the Size field and drag each relevant sprite to the fields opened.</p><p><strong>Animation</strong></p><p>Let’s say that you have a game object called Player and you want to add some animations to him as he runs or jumps, etc.</p><p>Open Player’s Inspector and add Animator Component.</p><p>P.S. It is suggested to create an Animations folder in your Assets so that you can keep all animations in one place.</p><p>Right click on Animations folder, hover over Create, and select Animator Controller.</p><p>Select all your relevant sprites, right click on them and hover over Create, and click on Animation. That will create an animation of the sprites you selected. Don’t forget to put that animation in Animations Folder.</p><p>So in Animations folder, we have an Animation and an Animator. Click on Animator, you’ll see a window opening, which has Any State, Entry, and Exit states in it. Drag your animation in that area.</p><p>P.S. Click on your animation and click on Loop Time for your animation to play continuously. Otherwise, it will play just once.</p><p>Click on the Player game object. You’ll see a Controller filed under Animator component. Click on it and select the Animator you created.</p><p>P.S. Add a Sprite Renderer component to your Player game object and set your Sprite in order to see your character on the scene.</p><p><strong>Animation Transition</strong></p><p>Let’s say that you have two animations as Running and Jumping and we want to make a transition between them. Right click on Running, select Make Transition and drag your arrow over Jumping.</p><p>Click on the arrow. In Settings, change Transition Duration and Exit Time to 0, because we want our commands to be executed immediately. Also, turn off the Exit Time for continuous movement. For example, if Exit Time is off, as long as you press the arrow on your keyboard your character will run.</p><p>Click on your Animator, and then select Parameters. Click on the plus (+) to add a parameter to use as a condition.</p><p>Let’s say that you choose bool, and you named that parameter isRunning. In the Inspector, under Conditions you can add your parameter isRunning, and set it to true.</p><p>Click on Jumping, and make a transition back to Running. In Settings, change Transition Duration and Exit Time to 0. Also, turn off the Exit Time. In the Inspector, under Conditions you can add your parameter isRunning, and set it to false because while jumping the character is not running.</p><p><strong>Prefabs</strong></p><p>They are game objects that are used as reusable templates. The main template is referred as Prefab, and the copies of it are referred to as Instances.</p><p><strong>Composite Collider for Tilemaps</strong></p><p>Click on your platform and add a component called Tilemap Collider 2D. That component will create a collider around your platform. And that component, click Use By Composite.</p><p>Right now, via using your Tile Palette if you enrich your platform, the collider will adjust to it.</p><p>It also comes with Rigidbody 2D component. Because our platform is not going to move, we can change our Body Type to be Static in our Rigidbody 2D component.</p><p><strong>Input System</strong></p><p>Install Input System from Package Manager. Click on your Player and add Player Input component.</p><p>In Player Input component, click on Create Actions, and save it your Assets.</p><p>P.S. It would be better to create an Input System folder in your Assets and move your action to that folder.</p><p>Click on the action and drag it into the Actions field in Player Input component.</p><p>Double click on your created Action. There you can see some actions such as Move, Fire, etc. If you want to add a new one click on “+” and name your new action, let’s say Jump.</p><p>Chose your action type to be Button. Set its Binding to be Space[Keyboard]. And click on Keyboard&amp;Mouse under Use In Control Scheme.</p><p>P.S. Under Player Input component, under Behaviour — Send Messages field you can see all messages can be sent with Player Input.</p><p>P.S. To be able to use Input System in your scripts, write this code at the top of your script:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93f54a2f1f2efdaa2a8bb58d6b4751b0/href">https://medium.com/media/93f54a2f1f2efdaa2a8bb58d6b4751b0/href</a></iframe><p>If you want your character to move right, left, up, or down you have to reach and grab Rigidbody 2D, because it is responsible for physics.</p><p>If you want to control your animator which you’ll have to if you want to switch between animations, you should declare your Animator variable in your script.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b86a2817601b4dc585c7f0ec0701118e/href">https://medium.com/media/b86a2817601b4dc585c7f0ec0701118e/href</a></iframe><p>Then in our Run() method, we can set isRunning parameter to true, so our character will start running.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5eff332caf4145cfddc95e71e1d6805a/href">https://medium.com/media/5eff332caf4145cfddc95e71e1d6805a/href</a></iframe><p>If you want to check if a value is pressed, you can use the following structure. Let’s say that we want our character to jump when we press Space[Keyboard] (as we set in the Input System before):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/741f69a95c653c6712c77ed2cf14486e/href">https://medium.com/media/741f69a95c653c6712c77ed2cf14486e/href</a></iframe><p><strong>Collider2D.IsTouchingLayers()</strong></p><p>It returns a bool. It shows if the specified collider is touching another layer or not.<br>It is used with LayerMask.GetMask(“layer”).</p><p>P.S. If you want to check what layers collide with what, open Project Settings, click on Pyhsics 2D, and scroll down.</p><p>If you want to get a reference to a collider you should declare it as a variable. Then you can check if it collides with a layer or not.</p><p>First, we get a reference to our collider:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59a95fca8e877ec77931daed6876999e/href">https://medium.com/media/59a95fca8e877ec77931daed6876999e/href</a></iframe><p>P.S. Let’s say that our Player is climbing the ladder. At first, when you stop pressing the up arrow on your keyboard, you’ll see that the Player sliding down because of gravity. When he is on the ladder if you change gravity to 0, he will stop sliding. Do it in your script, using Collider2D.IsTouchingLayers() method. As long as the Player collides with the ladder, gravity will be 0.</p><p><strong>Cinemachine Confiner</strong></p><p>Let’s say that you don’t want your camera to show beyond some specific border.</p><p>Add collider to your Background, that can be Polygon Collider 2D because your background might not be rectangle. Then click on Cinemachine and scroll down to Extensions in the Inspector. Add CinemachineConfiner extension. Now you’ll see Bounding Shape 2D field. Drag your Background tilemap there.</p><p>When you do that there might be a conflict of layers. So check your collision layers, the Background’s collision layer should be different than others. In Projects Settings &gt; Physics 2D, arrange Background to collide with nothing.</p><p><strong>State Driven Cameras</strong></p><p>Different cameras are being activated in different states. For example, when the Player is running camera zooms out, when he is only standing the camera moves in, etc.</p><p>Right click on an empty space in Hierarchy, hover over Cinemachine, and select State-Driven Camera.</p><p>P.S. when you create a new object, don’t forget to reset its Transform.</p><p>You can create new cameras via copy-pasting in State-Driven Camera. And in the Inspector under CinemachineStateDrivenCamera you can lists your cameras and match them with specific animations. And in Custom Blends, you can set Ease In Out, etc.</p><p><strong>Physics Material 2D</strong></p><p>Let’s say that you want your Player to jump when drops on a mushroom.</p><p>Create a Materials folder in your Assets. Right click on it, respectively hover over Create, 2D, and select Physics Material 2D.</p><p>Click on your material and in the Bounciness field you can set how much your character is going to jump when he touches the mushroom. If you set it to be 2, the Player will bounce off 100% higher.</p><p>And in your Mushroom’s Inspector, under Tilemap Collider 2D, drag your material to the Material field.</p><p><strong>Instantiate()</strong></p><p>It is used to create an instance of a game object. It is mostly used for prefabs.</p><p>P.S. It creates a new object in the memory. So, it should be used wisely, otherwise, it would cause performance issues.</p><p>Let’s say that we want to create a bullet right at the position:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4dd617bf3a8cc3452f5d64343cc13d1/href">https://medium.com/media/d4dd617bf3a8cc3452f5d64343cc13d1/href</a></iframe><p><strong>Coroutines and Changing Scenes</strong></p><p>Coroutines help us to create delays in our game.</p><p>Let’s say that we have 3 levels we created in our game. Click on File &gt; Build Settings and drag all your levels under Scenes In Build. Do not forget to re-order them.</p><p>Add your SceneManagement namespace to the top of your script because you’ll be loading new scenes.</p><p>Let’s say that when the Player collides with out Exit board, he’ll pass to a new level. But before passing, we want to him to wait a little bit for a better game experience.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed6a582f40eec1c18513d03a6c299e00/href">https://medium.com/media/ed6a582f40eec1c18513d03a6c299e00/href</a></iframe><p><strong>Game Session</strong></p><p>It is responsible for the score, level progress, lives, dying, restarting the game, etc.</p><p>It is written in a script called GameSession.cs.</p><p><strong>Singleton</strong></p><p>It is a design pattern that ensures that a class has only one instance. It is usually used for game objects that need to be shared across entire levels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4181771fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quiz Game: FACTFULNESS]]></title>
            <link>https://medium.com/@emrebaskak/quiz-game-factfulness-5d985ddc61c8?source=rss-31c786f592a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d985ddc61c8</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[2d-games]]></category>
            <dc:creator><![CDATA[Emre Baskak]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 16:06:13 GMT</pubDate>
            <atom:updated>2022-12-26T12:45:35.050Z</atom:updated>
            <content:encoded><![CDATA[<p>Game no 3: FACTFULNESS!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uRqJxOdR1b0Ga_Nc_7uvbw.png" /><figcaption>Quiz Game: FACTFULNESS</figcaption></figure><p>To play the game on the web, please click the link below:</p><p><a href="https://sharemygame.com/@EmreBaskak/factfulness-quiz-game">Play FACTFULNESS QUIZ GAME in your Browser | ShareMyGame</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*NtopKjxh_x0Q_toeTj6fVA.gif" /><figcaption>Quiz Game: FACTFULNESS</figcaption></figure><p>It is a small quiz game to test how well you know the world you live in! The game is named after one of my favorite books FACTFULNESS by Hans Rosling and the questions are taken from that book.</p><p>I created it with UNITY and C#. Honestly, it was more challenging than the first two games I created, but it was great practice to learn about the UI side of games such as buttons, slider, timer, as well as game score, etc. I also used Game Manager in Unity for the first time.</p><p>I’ll be writing some of the key methods and game mechanics that I learned to create this game.</p><p><strong>UI Canvas</strong></p><p>Right click on Hierarchy, hover over UI, and select Canvas.</p><p>Right click on Canvas in Hierarchy, hover over UI and you can see items you can add to your canvas such as images.</p><p><strong>TextMeshPro</strong></p><p>Click on Window, then select Package Manager. Change Packages to Packages: Unity Registry. Then, find and download TextMeshPro.</p><p>Click on Window, hover over TextMeshPro, and click on Import TMP Essential Resources. Make sure everything is selected and click on Import.</p><p>Right click on Canvas in Hierarchy, hover over UI, and select TextMeshPro.</p><p><strong>Font for TextMeshPro</strong></p><p>Find and download a font you like. Then, drag and leave it in your assets.</p><p>Click on Window, hover over TextMeshPro, and click on Font Asset Creator. Drag your font to Source Font File, click on Generate Font Atlas and save it.</p><p>Click on your text box and drag your newly created font to Font Asset field.</p><p><strong>Buttons</strong></p><p>Right click on Canvas in Hierarchy, hover over UI, and select Button — TextMeshPro.</p><p>P.S. If you can’t see your button, check your Sort Order.</p><p>Click on Button in Hierarchy, and scroll down in the Inspector that is opened. In the Button component, you’ll see an Interactable option. That option decides if the button is clickable or not.</p><p>P.S. It is suggested to change Transition to None. It makes it simpler and easier to deal with buttons.</p><p>If you want to add more than one button, it is better to add Layout Groups as components.</p><p><strong>Scriptable Objects</strong></p><p>They are data containers that keep data out of your scripts. So they help us save memory by storing the data in one place.</p><p>In your script, change the class to a ScriptableObject.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e87845608850212208841280e1bb8261/href">https://medium.com/media/e87845608850212208841280e1bb8261/href</a></iframe><p>[CreateAssetMenu()] here helps you to add your scriptable object to your assets.</p><p>Click right on an empty space in your Assets, hover over Create, and select Quiz Question. Then you see your scriptable object named New Question added to your assets.</p><p>Then if you click on your scriptable object, you can see a Question box in which you can write your question.</p><p><strong>Getter Methods</strong></p><p>It gives a script read-only access to a private variable.</p><p>P.S. “void” in writing methods means that that method will not return anything. But if we want a method to return a thing we change that void to a string, or int, etc.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1406ece598d21b59b65ac1bceb9e43b2/href">https://medium.com/media/1406ece598d21b59b65ac1bceb9e43b2/href</a></iframe><p>P.S. question is declared above in the scriptable object class.</p><p><strong>Arrays</strong></p><p>To create arrays, there are two ways:</p><p>a) int [] numbers = {1, 2, 3, 4, 5}</p><p>b) int [] numbers = new int[5]</p><p>Check the codes below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b85be4b20bbcb02320886cd36c18fe5/href">https://medium.com/media/3b85be4b20bbcb02320886cd36c18fe5/href</a></iframe><p>The codes above will create Answers option in our New Question scriptable object. indexCorrectAnswer will help us to determine the correct answer on unity.</p><p>To get access to TextMeshPro in our scripts, we add</p><p>using TMPro;</p><p>to the top of our script.</p><p>You also declare a UI-based TextMeshPro variable as TextMeshProUGUI. For example;</p><p>[SerializeField] TextMeshProUGUI myText;</p><p>P.S. When a button is clicked, it changes color. We can arrange that declaring sprite variables as [SerializeField]. For example;</p><p>[SerializeField] Sprite correctAnswerColor;</p><p>[SerializeField] Sprite wrongAnswerColor;</p><p>Now, under your script in Inspector, you’ll see two fields: Correct Answer Color and Wrong Answer Color. You can drag and leave sprites on the relevant fields.</p><p>P.S. If you are adding an Image variable, do not forget to add</p><p>using.UnityEngine.UI;</p><p>to the top of your script.</p><p><strong>Timer</strong></p><p>Add the timer sprite on the canvas and open its Inspector. In the Image component of the Inspector, select Image Type to be Filled.</p><p>P.S. If there are a lot of [SerializeField], we can group them in [Header(“”)], without putting a semicolon at the end, for clarity. For example,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6d2a13e13027bf6244f3ef1d41f0689/href">https://medium.com/media/d6d2a13e13027bf6244f3ef1d41f0689/href</a></iframe><p><strong>Lists</strong></p><p>Lists are mutable but arrays aren’t. A list is created as below:</p><p>List&lt;int&gt; numbers = new List&lt;int&gt;()</p><p>We used lists to store our questions for their mutability.</p><p><strong>Slider</strong></p><p>Right click on Hierarchy, hover over UI, and select Slider. Then place the sider anywhere you want on the canvas.</p><p><strong>Game Manager</strong></p><p>It is basically a script. It keeps track of game states. Menu/pause systems are managed by Game Manager. In our example, the switch between the end canvas and the quiz canvas itself is managed by the Game Manager. For audio/video settings, control bindings, and game save data purposes it records and stores information.</p><p>P.S. Game manager should exist over multiple levels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d985ddc61c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>