One of the most common questions I get from students looking to build a platformer is this: how do I build a moving platform in Unity? Well, if you are looking for code that you can just copy-paste into your project, look no further.
Continue readingPosts categorised under:
Copypasta
How I made double dashes automatically convert to em dashes in WordPress Gutenberg Editor
Over the weekend, I was tackling a client request requesting for us to help modify their WordPress backend so that when writing posts, the Gutenberg Editor will automatically convert consecutive double dashes --
to an em dash —
character.
It was a particularly difficult task for me, despite having coding in WordPress for many years, simply because the Gutenberg editor was relatively new, and there is very little documentation regarding it.
Continue readingCreating a Farming RPG (like Harvest Moon) in Unity — Part 15: NPC Interaction
This article is a part of the series:
Creating a Farming RPG (like Harvest Moon) in Unity
Ever wanted to create a game like Harvest Moon in Unity? Check out Part 15 of our guide here, where we go through how to create a dialogue system and create the relationships with other characters aspect of the game. You can also find Part 14 of our guide here, where we went through how to set up scene transitions.
A link to a package containing the project files up to Part 15 of this tutorial series can also be found at the end of this article, exclusive to Patreon subscribers only.
Enumerations explained (using Pokémon as an example)
What are enums anyway, and what are they used for? Well, just think of it as yet another tool in your handy Java toolbox of things you can consider using to improve your efficiency and organisation of your program.
In this article, we are going to explore what enums are, and how they can be used in Java, by considering a piece of Java code that uses enums to recreate the type effectiveness system found in Pokémon.
Continue readingWhy doesn’t vertical-align: middle
work? How to vertically-centre elements in HTML and CSS
If you are new to working with CSS, you may find that the language comes with its fair share of quirks that can be frustrating, such as the text-align
attribute not always working at horizontally-aligning your content.
In a similar way to text-align
, the vertical-align
attribute doesn’t always work at aligning your content vertically. Take the following HTML code for example:
Creating a Farming RPG (like Harvest Moon) in Unity — Part 13: Title Screen and Obstacle Generation
This article is a part of the series:
Creating a Farming RPG (like Harvest Moon) in Unity
Ever wanted to create a game like Harvest Moon in Unity? Check out Part 13 of our guide here, where we go through how to set up the main menu and generate obstacles. You can also find Part 12 of our guide here, where we went through how to implement the player's sleep feature, as well as saving game data to both JSON and binary files.
A link to a package containing the project files up to Part 13 of this tutorial series can also be found at the end of this article, exclusive to Patreon supporters only.
Creating a Farming RPG (like Harvest Moon) in Unity — Part 12: Sleeping and Saving
This article is a part of the series:
Creating a Farming RPG (like Harvest Moon) in Unity
Ever wanted to create a game like Harvest Moon in Unity? Check out Part 12 of our guide here, where we go through how to implement the player's sleep feature, as well as saving game data to both JSON and binary files. You can also find Part 11 of our guide here, where we went through how to save our farmland's data.
Splitting a CSV file into multiple MySQL tables
In a previous article, we explored how to import a CSV file into a table in MySQL. This is a continuation of that article, where we will explore how to split CSV files that contain data which is supposed to go into multiple tables.
Continue readingCreating a Farming RPG (like Harvest Moon) in Unity — Part 9: Improving on the Inventory System
This article is a part of the series:
Creating a Farming RPG (like Harvest Moon) in Unity
Ever wanted to create a game like Harvest Moon in Unity? Check out Part 9 of our guide here, where we go through how to improve on our current Inventory system. You can also find Part 8 of our guide here, where we went through how to make crops that can be harvested multiple times.
A link to a package containing the project files up to Part 9 of this tutorial series can also be found at the end of this article, exclusive to Patreon supporters only.
Continue readingImporting a CSV file into an SQL table
CSV stands for Comma-Separated Values, and CSV files are text files that look something like this:
example.csv
Username,Email,Address,Contact johndoe,john@example.com,"71 Pickering Street, Singapore, Singapore",+65-91234567 janedoe,jane@website.com,"24 Raffles Lane, Singapore, Singapore",+65-81234567 marysmith,mary@smith.com,"83 Riveting Road, Singapore, Singapore",+65-97654321 bobsmith,bob@smith.com,"84 Riveting Road, Singapore, Singapore",+65-87654321
Essentially, the CSV file format is meant to represent tabular data. The above CSV file represents the following table:
Username | Address | Contact | |
---|---|---|---|
johndoe | john@example.com | 71 Pickering Street, Singapore, Singapore | +65-91234567 |
janedoe | jane@website.com | 24 Raffles Lane, Singapore, Singapore | +65-81234567 |
marysmith | mary@smith.com | 83 Riveting Road, Singapore, Singapore | +65-97654321 |
bobsmith | bob@smith.com | 84 Riveting Road, Singapore, Singapore | +65-87654321 |
Due to their tabular nature, data in a CSV file can very easily be imported into and stored in an SQL table. The commands to do that, however, are not very well-documented online.
If a CSV file does not open as a text file on your computer, that’s because your computer is opening the file with a spreadsheet program such as Microsoft Excel. In such a case, to see the file as text, you will want to open these files on a text editing software such as Notepad.
Continue reading