Chaveirinho
A tiny virtual pet made as a gift · my first mobile game (2014)
- Year2014
- EngineUnity (pre-Canvas)
- PlatformAndroid
- Team2
Highlights
- A pocket virtual pet with personality: she loves chocolate milk, but only one brand, and gets mad if fed the other
Overview
Made in a few days around Christmas 2014 with a friend, as practice and as a gift: a tiny virtual pet based on a real person, to carry around on a phone. Neither of us knew anything about mobile development yet, and Unity didn’t have its Canvas UI system.
Its one quirk: she loves chocolate milk, but it has to be Nescau. Food is random, and if she gets a Toddy instead, she gets mad. The screenshots were taken in the BlueStacks emulator back then.
Technical deep dive
What we learned
Our first project together outside college. Below is one case of the switch in Update that handled the buttons, from before Canvas existed:
if (Input.touchCount == 1)
{
if (Input.GetTouch(0).phase == TouchPhase.Began && guiTexture.HitTest(Input.GetTouch(0).position))
{
switch (name)
{
case "Food":
{
temp = aux[Random.Range(0, 6)];
TamaCenter.instance.Feed(food[temp], temp);
break;
}
}
}And our attempt at something that felt like actually petting her:
if (Input.touchCount == 1)
{
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
RaycastHit hit;
if (collider && collider.Raycast(ray, out hit, 100f))
{
if (collider.name == "Bedinha")
{
start = true;
}
}
}
else if (Input.GetTouch(0).phase == TouchPhase.Moved)
{
if (start)
{
TamaCenter.instance.animation.Play("Carinho");
TamaCenter.instance.Affection(5);
}
}
}Images
Like this project? Get in touch or connect on LinkedIn.

