Pages

Sunday, August 25, 2013

Unity3D + C#: Copy all the values from an existing component to another (derived) component, using Reflection

Happens to me all time. I have a prefab with a component such as "Player.cs" which contained over 30 variables of different types, including Transforms and GameObjects too. That it become such a hassle to configure all of them when I wanna make a new class which derived from "Player.cs"... say "Warrior.cs" with a structure like this:

public class Warrior : Player
{
}


For sure, the Warrior class will inherits everything from Player class, but that also means you have to reconfigure everything again (without a proper tricks), which is such a tedious work (though it can be done in a short time, if you don't have as many prefabs using the same script as me).

Saturday, August 17, 2013

Notes on Lightweight SWF (LWF) framework for Unity

Lightweight SWF, or LWF, is an open-source framework created by Gree for importing Flash animations into Unity. It's official page: https://github.com/gree/lwf

The infos provided in their wiki are a bit messy, thus this post will try to serve as another organised starting point for using LWF.

For starters, you need to learn how to convert SWF into something readable by the LWF plugins, using a software provided by them called LWFS:


And here's a tutorial (provided by Gree) on how to play the (converted) SWF inside Unity:
https://github.com/gree/lwf/wiki/ForUnity

Extra infos about the Flash animation production guidelines are also provided by Gree:
http://gree.github.io/lwf-demo/pdf/FLASHforLWFproductionguideline.pdf

The guidelines are a bit confusing for me, so I'm just gonna write my own version below.

Friday, August 2, 2013

AREAS - A Simple Maths Game About Areas - GameDev Notes

// Play the game here: leezhifei.com/projects/areas/index.html 

I have been doing an on and off HTML-learning for the past few weeks. My main purpose of learning HTML was more for game development than building websites.

It was about last Saturday, when I decided that I've learned enough, and it's time to take what I've learned to use -- I'm gonna build a HTML5 game!

I was just searching around the web for idea when I incidentally stumble upon a simple Maths calculation of Areas and Volumes of a shape (or polygon). So I decided to make a game based on that topic.

For this particular project, I don't intend to touch too much on sprite-animations just yet, as I kinda gave the project a 2 day limit. So I need to finish building the game within 48 hours, as if I'm doing a game jam of my own. But in the end, it took me more than 2 days (5 days to be exact) to finish the project, in which I spent the first 2 days focusing on the core mechanics, and the rest of the 3 days on level design. I also tried to focus a lot on the colour-aesthetic of the game.

As much as I would love to continue working on it (not the game, but more on the outlook of game page, play around with CSS, etc), I was more eager to release the game as I have other ideas I wish to pursue.

Here are some photos of the level design I did for the game (it's like trying to come out with Maths question like a Maths teacher, lol):