Cat Trophy Kingdom: Building a video game with Airkit’s low-code platform
Tags: lowcode, programming, webdev, tutorial
Published: 2022-10-11 22:09:51

# Cat Trophy Kingdom: Building a video game with Airkit’s low-code platform

A few weeks ago, in preparation for releasing version 18.1 of Airkit, some coworkers and I were stress-testing the new animation functionality. We started with the basics, things we imagined might be among the most common use cases: building out a customized progress bar, associating an animation with the appearance of a warning label so as to draw more attention to it. Then, with the cadence of a joke, someone asked, “Can we animate a chicken crossing the road?”

The answer, as it turned out, was that we could. Easily. It took less than ten minutes and required only two assets: a JPEG of a road at dusk, and a GIF of a dancing chicken.

![A gif](https://lh3.googleusercontent.com/bhgJ8FclWl008vuHVWDLiO33t80A26UHh_deiOSbj6gpkweYYuZzq2geYD3gHfAGspErVKWlf_SytlIp4VbVJz2XrjXX77y7SF8FcAbCwIgPJ60XYg0xOLrew0aaAT2BhSCkAyP1IAELUcqo6yiISlSCcheeKmTxKypbKHzB34V66BTQKkTiDMoZ6w)

I was in love. In the span of less than ten minutes, this road-crossing chicken had become my muse, for it made me realize two things:

1.  Airkit’s animation functionality can be combined with GIFs to create the illusion of complex motion with very little effort.
    
2.  If you can animate a chicken moving in one direction, you can apply the same principles to move _any_ character in _any_ direction.
    
And once I had realized those two things, the conclusion was inevitable. I would use Airkit to build a video game.

In around 48 hours, I had put together [Cat Trophy Kingdom](https://app.airkit.com/cat-trophy-kingdom), a short CRPG (Computer Role-Playing Game) where you earn the crown of Cat King by knowing trivia about how to build in Airkit.

![](https://lh4.googleusercontent.com/qK1eDVbygEaQeOZ9-fzKiiR2w8OXkyWM0gtAV90AspkABAXzynGgd3tSmQQ4CT7ISB0ryQ4rgwId7nXyNjY_zJPJLgkEE0oGka1aesziveTyRwVykbLBMdOxAQTInDl2ro49_CcUDNb21R25p9pW0sYhLq_P-muZglolp3zqDgkxIwPim5sfMoS1ew)

*(Pictured: A brief snippet of Cat Trophy Kingdom. Click [here](https://app.airkit.com/cat-trophy-kingdom) to play!)*

This is absolutely not the sort of thing Airkit was optimized to build, and so while I did have to implement a few hacky work-arounds, I was overall pleasantly surprised by how quickly I was able to throw together something so far beyond the scope of CX automation.

Let me tell you about how I did it.

# Building the Castle

When I first started building, I had only a vague idea of how I wanted the game to go, and I wasn’t entirely sure what would be feasible to complete in the 48-hour period I had given myself. I started with the basics: the game needed a protagonist.

After considering the constraints I was working within, not least of which was time, I decided to make a GIF of a little yellow cat held up by balloons. Out-of-the box animation in Airkit is smooth thanks to the automatic incorporation of easing, which looks good in combination with gentle bobbing. A floating means of transportation also meant that I didn’t need to worry about timing and configuring a complex walking cycle.

![](https://lh4.googleusercontent.com/neUKeijjx951Ml7sGCwry0riR7PTDTOUYrpkTz6vrH7AXhf4u2B8kxGNAJQ4GBPJslgXZxTxhlTl8ThAkK6Y5PTPC23ZFDOu3ufLp7HkH_oOgSekofNBfhna8tw-L0MajIghaVBr22fa0fOHI87G-wj6ZiljRRxZjjfSmy8_vR4wkcl0vJyy-CcfRA)

Almost immediately, I began to mentally refer to this cat as the “PC,” which stood simultaneously for “Player Character” and “Player Cat.”

Now that I had my PC, I needed to create a space for them to explore. I’d already decided that I wanted to set the game in a castle, so I found a picture of some masonry that could pass as a castle floor. This, I set as the background for the [Container](https://support.airkit.com/reference/container-web-control) that would hold all the furniture and characters that would exist in my digital castle, starting with my PC. For the sake of organization and scalability, I put the [Image Web Control](https://support.airkit.com/reference/image-web-control) containing the GIF of my PC in its own Container, which nested under the broader Container encompassing the whole castle floor. It was to this sub-Container that I would apply animations. I was kicking around the idea of having visible objects float alongside the PC under certain circumstances, and I didn’t want to have to animate them individually.

  

![](https://lh4.googleusercontent.com/L0N_MDz1kBCI-7yDNzQ0Tkc9i7YSJKzSyRqOtceWR18eoeyeo3UXvJpLdrRoLbBJtQhsv2TUhPw7veX7qe4wWI1lmQG-N27g-lT_OmsXwCs7SV3Yb2_ITLCkvcl3Yb7P5O3MyMLuMnKHtzQsLnch012rPuIw0IPid5ALyNU48ZnFwUHE0bvXKAxXPw)

The PC needed a way to move about the castle floor, not in a single direction, but four: up, down, left, and right. These would dictate movement along two dimensions: the vertical and the horizontal. I defined two variables to keep track of the cat’s placement along these dimensions: **x**, to track distance in pixels from the leftmost border, and **y**, to track distance in pixels from the upper border. So that their values could be easily changed by simple addition and subtraction, both of these variables were `Numbers`. (This whole setup was based off of the standard [Cartesian plane](https://en.wikipedia.org/wiki/Cartesian_coordinate_system), with the orientation of the y axis reversed to avoid having to work with negative margin values.)

Upon updating the Airkit platform to v18.1, animations are incorporated into the preexisting UI of the platform by tying them to the [styling properties](https://support.airkit.com/reference/common-style-properties-of-web-controls) of [Web Controls](https://support.airkit.com/reference/web-controls-overview). While styling properties are defined statically by default, they can also be defined in terms of variables, and changes to the values of such variables are reflected as changes in the appearance of the Web Control. Applying animations to the variable styling properties smoothens the transition. The Container that held my PC, then, would have varying values of the left and top margins, which would change according to the values of **x** and **y** respectively. (Because I had defined **x** and **y** as `Numbers`, I needed to use the [FORMAT_NUMBER](https://support.airkit.com/reference/format_number) function to convert them into a string the margin expression could parse. The left margin was defined as `“{{FORMAT_NUMBER(x, “”)}}px”`, and the upper margin was defined as `“{{FORMAT_NUMBER(y, “”)}}px”`.)

I then animated changes to the margin so that the transition between different margin values would take place over the span of a second:

![](https://lh5.googleusercontent.com/wqvNHqsrF4je8KAbtRwDmnm8SJVb02iNs-mYLYZZ250RfqLbJaPoAUpPFTSdSJUEe3hd4COGGRbTi9x5dXn7MubzNIJ2VgXBEZqUSy5vD3YaRA2akJEJN4ezfFe78U5hCEsS5BcQD-xsnbOK7_wtq30udB6R9xmIzgZMR_tAhMyJFPNcBIZrAwybEg)

The values of **x** and **y** would be changed by pressing [Buttons](https://support.airkit.com/reference/button-web-control), which would trigger the [Set Variable Action](https://support.airkit.com/reference/the-set-variable-action) to change the value of **x** or **y** as appropriate.

  

![](https://lh4.googleusercontent.com/Gjbj-p_g2aclFEpyJ9IPalKmCiNTfRIcn4o6rf2b_6Xn10IQOljSch4-f9jLl_DzOULbyGTgIMNTGnTf97mo85IcH-I7sDChTeUX1ku3Cn8F_maQJ0wUBZ1AmjEmEWCMcbU5ODM2wuRKhvLjgwgWHTTSWDNrndgqn6ok5T4KiVeQ_l5PSLdi4E4Lpg)

The values of **x** and **y** would change by adding or subtracting numbers to or from their initial value, so once the Buttons were configured, I set up the initialization of **x** and **y**. Upon navigating to the [Web Page](https://support.airkit.com/reference/web-page) on which I was building my castle, two Set Variable Actions would be fired, setting first **x** to 0 and then **y** to 0.

![](https://lh6.googleusercontent.com/3L8vD2aXmMqoUV-yXxZAOU_fozEgLqmqP4MgWfopIaEKAntDE2OVi-hOXtZ-YaActqzWJ82E7SycVyT4MhEFlXXKcOaKiIHXgVfLdYUWy5YOR8aaIS5qeC2BtgXleVS1Tb1k53lZlo0K9KDxoP52mrsrgBejsjHcOvqc-WW8ARaZ2pI7nuc7QLchwg)

*(Pictured: A fancy cat doing a fancy dance.)*

By this point, I had built out something only marginally more complicated than the chicken crossing the road, and it was becoming clear that I was going to have to find ways around Airkit’s core assumptions if I wanted to get much further.

Airkit apps are designed to be easily accessible on screens of any size, browser or mobile. Out of the box, Web Controls don’t have a set pixel size; they scale automatically to account for the size of each user’s screen. When defining dimensions within styling properties, Airkit parses input given in either pixels or percentages. “50px” means fifty pixels, and “50%” means fifty percent of the Container the Web Control is nested under, which by default depends on the size of the screen being used to view the app. In most of the common use cases, the things Airkit was optimized to build – form digitization, call deflection – it’s considered best practice to define lengths in terms of percentages when possible, allowing the UI to appear standardized regardless of screen size.

As you may have already noticed, I was not doing this. I was already defining my PC’s movement in terms of pixels, not percentages. To better create the illusion of various images interacting with each other, I wanted fine control of each image’s location down to the pixel.

So I redefined the size of the castle floor Container, overwriting the defaults that would adjust the size to fit the screen it was displayed on. This meant I had to pick, then and there, what sort of screen ought to be used to play the game, and I decided to make a computer game, not a mobile-friendly experience. I set the size of my castle floor Container to exactly 1200 pixels by 900 pixels and tinkered around with the [Page Layout](https://support.airkit.com/docs/page-layout) so that the layout would remain the same regardless of screen size. This would render the game effectively unplayable if someone tried to access it from their phone, but that was a sacrifice I was willing to make.

This also meant I had to put the **Up**, **Down**, **Left**, and **Right** Buttons in a Container and adjust their placement so that they were more obviously visible on a computer screen.  

![](https://lh5.googleusercontent.com/-RgpPg-Ym_LPIL0GifATn6AVv5qdXjW84Aci7e61KSi6iR0m_1VeCnUG_kXgWlqAgaUtG27K0oiVo-kwQwGQDEVkjkQ2zmBYGpDjXmb5dJDkd2YAGikMY6c6-apqCnPOLQCeZ1qS8lng48quPQu3A-5Okv-xkZwkK4BZxAZpPX573SwSqJ5SRpdtsw)

(This was my first time [changing the position of a Container from Relative to Absolute](https://support.airkit.com/reference/common-style-properties-of-web-controls), but it would not be my last.)

My PC now had a defined and finite castle floor to explore. Pressing the **Up**, **Down**, **Left**, and **Right** Buttons would move the PC some number of pixels in the desired direction. How far each Button would move the PC was entirely arbitrary, but as long as the size of the change stayed consistent, it imposed a conceptual grid structure on occupiable spaces. The PC would only be able to reach spaces divisible by the number of pixels it could move at a time.

Here is the convention I settled on. The PC itself would occupy a 100 pixel by 100 pixel Container, which would move in 100-pixel steps. The coordinates “defining” the position of the PC would be defined by the pixel at the upper left of the 100 pixel by 100 pixel Container. For instance, given **x** = 0 and **y** = 0, the PC would appear at the upper left corner, apparently filling up the space defined by all values of **x** between 0 and 99, and all values of **y** between 0 and 99.

![](https://lh5.googleusercontent.com/AW4oKqSbM638J1vS1P02XcZlJMdk0Gv1PcK-YNguhcuxqYewGazg57Es-qMkT3uF1X7OqbWmCVovw5fHojmvNsFvbKtR7KZnTBX1muNqXC6r0axLyfp6hEBf2SYyFOxC9Rk63SdoB-Avfz1YXXI6Q7Ha37s2JiXADl9hlqzp8l82wwxjhyW_yVS9ig)

*(Pictured: The grid as it exists in my imagination.)*

Upon saving and previewing my progress, I was delighted to see my PC move about as intended. However, the lack of limitations surrounding the castle floor quickly became apparent: pressing the **Up** Button too many times sent my PC floating up and away into the limitless void, never to be seen again.
  
![](https://lh3.googleusercontent.com/MYR-jev8cQt_bF2_6u4ds5FfX5ob3qzm7f1O7_5o9Be3OOjobjamV2HtInuOH_Qg6PdSmeoxI8JZNgrw2Di6PpcFvE0c8Qwop4EO4gyy-U-1YPs6vGk4-Pqv-VnqsBiaCVKSswfWJKbWTknKr6aIn1FogeVVM0K79ALUaGYy2jHqbjZ4nvPTMoj5AQ)

(Unless I pressed the **Down** Button an equally ludicrous number of times.)

I needed to impose further restrictions on the spaces my PC could occupy: I did not want them to be able to leave the castle floor, so I decided to create a new [UDF](https://support.airkit.com/reference/udf) (“User Defined Function”) to check if a proposed destination was within the established parameter. The UDF, designated `ISINSIDE#USER_FUNCTION`, took two `Numbers`, **x** and **y**, as input, used the out-of-box [IF](https://support.airkit.com/reference/if) function to return the boolean `TRUE` if **x** and **y** described a position inside the castle, and returned `FALSE` if otherwise:

![](https://lh4.googleusercontent.com/nCzbKhA1fJwCyDhbp3-bQB6mewzrEPLM8hWhbFbYDXdiJ_lIOas_2sGRztRqhbimaDZagNEJQ4_27Tpu9ji1ejUYjkEq2TeoZrMHUtUOOPQKhw3zdvVMrGcG9lTROqPqL47WFs5wJZhtKvJosA8V-YtpTjQWyiC89iQi8XbYIXTHjxDIQ-7qvElJJA)

By making this a UDF, I was able to reuse it easily, and I incorporated it into the Action Chains associated with the **Up**, **Down**, **Left**, and **Right** Buttons. Now, before resetting the value of either **x** or **y** (as appropriate), each would run a [Conditional Action](https://support.airkit.com/reference/the-condition-action) to check if the new coordinates were inside of the castle. If they were, the cat would move as asked. If not, the cat would stay still.

![](https://lh4.googleusercontent.com/nhAKSHxyCGed0GCWoUi9GtjPjq2c_emv_vqF_DVbDeJXlCou0QlhAOrtc3bK0mlCPQ0R6MY3UZwVyUKFlByvy2flB5vdKSoPVepOEKmAfDPAuRXfShAd2XYKzeNXd-oFaOSF1PmHMJazQo48XewceUuBxN-FGdxUVDk3rm25snw-2r98EX7jt_dnfQ)

This accomplished the illusion of the cat being unable to pass through the implied walls.

![](https://lh6.googleusercontent.com/jo-SLlKScg3F3KHI3hEkzjuiAmOUo30q_VbQjW6UWuYB2vRAuw5MTc-JQi4w1Q62-PZ_dty3L-o0cwGXZsmu1ORUaIEEu7yZMnDYUp7DiRQ8oH9wFUIjvoR-wcJRuboWfSFKoT4LNMDP-NxPXLAyZ-RntEqNPfNwm8SVYCI8HTUInRWeku9cjhF9zw)

So now I had my PC, and the PC had a room to explore. Now was time to fill the room with characters and furniture for my PC to interact with.

# Interacting with Characters and Furniture

The process of building my castle floor had solidified two key ideas:

1.  My 1200 pixel by 900 pixel castle floor was also a 12 by 9 grid, in which my PC could occupy exactly one square at a time (and each square was defined by the coordinates of the pixel in the top left corner). The same principles could be applied to define the locations of furniture and other characters.
    
2.  Keeping track of the location of each character or piece of furniture could be done via UDF, and each UDF could be used in an additional IF ELSE statement associated with the Conditionals tied to the **Up**, **Down**, **Left**, and **Right** Buttons.
   
The first character I wanted to establish was the Cat King, as the PC’s interactions with him would make up a core part of the game. I whipped up a sprite for him, which I confined to its own 100 pixel by 100 pixel Container. His placement on the board was defined using the same conventions as I had applied to my PC, only no variables were required:

![](https://lh3.googleusercontent.com/ACv8MxKPFm4G78_Nw1FUQwxIloOG6ECmKauVMKGVCQ5vLzNJ-Fn9ZFo9wbZUUTQbYeVgRJVv-WQbT0OOHdPtZ3xOI9002XlAM1JuUErF-3OmI2WWNDAPng_Bc9gAtBkx2MTJ6IEZh-H6UrLU5WzrpV44RZ3OiaC--Zhohr4OfieR4o2uotW5IR9h)

This placed the Cat King in the location described by **x** = 800 and **y** = 100.

![](https://lh4.googleusercontent.com/NK9FMPQhcEpFFafABDuNxub_FIS4DpGMlbwzdDgJxK5twgPo7Y1GJr81na0PZ3wWcV-wkMTaICM7mO4m8k-CST2Madzw6yEhNGNgLF2Z4pSTc8lr081kNCwJbWyGO2hm-n858tWnfbDH5aB_ZJPv9TVrTtv2bXmBqIgrFOg6djMejTTIb00vzbR2Rw)

*(Pictured: The placement of the Cat King in my imagination.)*

I didn’t want my PC to be able to enter this occupied space, so I applied a similar strategy to the one I had used to prevent my PC from leaving the castle floor.

First, I created a new UDF, called `ONCATKING`:

![](https://lh6.googleusercontent.com/PlP7BrwYnYhwv3Uzbo9KRQeIptduAWlinDVJR-Zdwg2Gjr2Fx5kBt9zP_HB4D1wXzo0E6LzfT1zLKT_1VwmlCN5yKMmYtcedto6DLyBRYVJcxN-oogjuMHHuYqFjP0utFl0E6w02fA7W7v4c5Sa_ZOA_Z8vQC9v_W8UL5BTOY3l3Agf9hTu8lz3f)

 
Then, in the Action Chains associated with each of my **Up**, **Down**, **Left**, and **Right** Buttons, I added an IF ELSE branch and used my new UDF to trigger different behavior in cases where the PC tried to occupy the same space as the Cat King. Now, before resetting the value of either **x** or **y** (as appropriate), it would not only check to see if the new coordinates would be inside the castle, if they were, it would also check to see if the new coordinates would put the PC in the same square as the Cat King.

And if so, I wanted to [open a modal](https://support.airkit.com/reference/the-open-modal-action).

Up until this point, I’d been working within a single Web Page, but now I needed to make a new Web Flow, which I would open as a modal in order to bring up the Cat King’s dialogue and allow the player to select how they wanted to reply. In my early iterations, the Cat King’s dialogue was a simple [Label](https://support.airkit.com/reference/label-web-control), and the dialogue options were simple Buttons, which might [close the modal](https://support.airkit.com/reference/the-close-modal-action) or [navigate to another Web Page](https://support.airkit.com/reference/navigate-to-web-page-action) depending on the nature of the reply. For a bit of polish, I shortly after incorporated additional styling components, such as a drawing of the Cat King’s face, and a talk balloon gif from [Giphy](https://giphy.com). After nesting some additional Containers and playing around with Airkit’s out-of-the-box [styling properties](https://support.airkit.com/reference/common-style-properties-of-web-controls), I found a layout I liked, which I would later re-use (by copying and pasting) when creating additional character interactions.

![](https://lh5.googleusercontent.com/CsZii_OCSgiy8Ii8krmtNVUeiKzQqCPl6tCqfmWu6HES70XcuVDpD2LjddIFioZ4ce1QsJsfv7kE-srSH1JXbsYSshX0Le8aKgsB6lbQcJNFELV9EXhkXqhmnn6SoeWmYl-CXf-9qECShvHM89nKOtaMK_TZlT20kDVNyQWELrUkEOQxbUo104XmqA)

As I added more possible character (and furniture!) interactions to my game, I repeated this process in at least a dozen different forms. For each new interaction, I would place the sprite, make a UDF to test if the space was occupied by the sprite in question, and then I would incorporate the UDF into new IF ELSE statements in the Conditionals associated with the **Up**, **Down**, **Left**, and **Right** Buttons.

And yes, these Action Chains did grow very, very long, very, very quickly.  

![](https://lh4.googleusercontent.com/giwae6bN5MNQ2d76EdQ-wUmSSAIq94JFc8VdMCbKPr9Qs1bHG4A3eKjnQuwA7pAdNeM7M6xRMtV9niSq8iKeB0atn4iFjL217_awRzI5dtMVp7Mp-G9Kl6TeggSnAtuU2RS3qsRkA7hopDDA3hDZdtH6pV8ca61jbI98vMv2VvynYX5XpXUMrJ2T3w)

*(Image Caption: This Action Chain is too long for my computer screen to even display all at once.)*

## Key insight: Using UDFs to keep track of occupied spaces was an even better idea than I first thought.

When I first made a UDF to keep track of whether a proposed location was inside the castle, I had originally only been thinking to save myself from writing `x <  0  OR x >=  1200  OR y <  0  OR y >=  900` four separate times (one for the Conditional associated with each of the **Up**, **Down**, **Left**, and **Right** Buttons). I made UDFs to keep track of each occupied space for the same reason.

But as I placed more and more characters and pieces of furniture on the castle floor, I was sometimes struck by the urge to rearrange them, often for aesthetic purposes, more rarely to place the obstacles so that the way around them seemed less ambiguous. Regardless of why, moving the furniture meant both redefining the margins on the Container holding the furniture in question, and redefining the Conditional that managed the PC’s interaction with the furniture.

And when I needed to do that, I was glad I had a UDF that served as the single source of truth for the location of an interaction. Changing the UDF so that it referenced the new location of the occupied space was all it took to update every relevant Conditional, across every Button.

# Tracking Progress and Interactions

Now I had built my castle and filled it with characters and furniture for my PC to interact with. There was one last key component of the game to work out: tracking the PC’s progress.

Game-play-wise, the flow I had in mind was not complicated: the PC would talk to the Cat King, who would tell them to bring him a Cat Trophy. Then the PC would talk to the Court Mage, who would give them a riddle, and once the PC answered it correctly, they would get the Cat Trophy. Then the PC would bring the Cat Trophy to the King, winning the game.

The same modal could not be opened every time the PC went to the location of the Cat King. One modal needed to open when the PC did not have the trophy, and a different modal needed to open when the PC did.

I wound up tracking these sorts of interactions with `Booleans`. For instance, I created a `Boolean` variable called **have_trophy**, which was initialized as `FALSE` at the [start of the Journey](https://support.airkit.com/docs/starting-events) but reset to `TRUE` when the correct Button was pressed to answer the court mage’s riddle.

More IF ELSE statements were added to the Conditionals associated with the **Up**, **Down**, **Left**, and **Right** Buttons, and some of the IF ELSE statements that I had already made grew more complicated. For instance, the Condition that needed to be met by the **Left** Button in order to open the Cat King’s initial modal, where he told the PC to bring him a Cat Trophy, used to look only like this:

![](https://lh4.googleusercontent.com/gZHLjxCrAeUcMuccnwMx4cRR83Nwwcnou4l7RauZSU8feAF0jZQtFRYnAtNKOyho_d2-AgjtuqU1ioLgmxsgvGv_qslUwlfW2gIBXJOH_94ZdLt-VwGllbphOte1BdEkc3GwcJ4ShL7o4ncSHS2LU3z_gyCi00dSbfg-fxY7NNhfTP-rcLQaRTmcHw)

and now it looked like this:

![](https://lh3.googleusercontent.com/IAqYthNetmWd7HohNdANTWuYtYqeRj4YXv2d_3gsUlmWPDxn_z0uKrRMsI3PiHje3wU7VXd8S-yrfRpNmAsE2O5aMdiTRzRlgA6HOlQM31udxKEQ80WfdqeONlpcR9MggW2MuWqbssmzmyL6R0YJizsNYUwQa5xxNcljy-WY5Zh5XfH_EQefCCic4Q)

(The variable **have_trophy** is written as `session.have_trophy` here because it is a global variable. I made most of the progress-tracking `Booleans` global variables because changing their values was typically done in modals, and the modals, as separate Web Flows, are different [Activity Groups](https://support.airkit.com/docs/variable-namespaces) from the Web Page that held my castle floor.)

Once my PC had earned their trophy, in addition to opening a different modal when interacting with the Cat King, I also wanted to have a little trophy float next to the PC’s sprite as they moved about the castle floor. As you may recall, I’d been kicking this idea around for a while, and I was prepared for it. The image of my PC was already inside a Container, and I could easily add the image of my trophy to the same Container. After a bit of resizing and tinkering with the margins of the trophy image until I was satisfied with its placement in relation to my PC, I toggled to the **Advanced** tab of the Inspector, and set the Is Visible field so that it was equal to `session.have_trophy`.

![](https://lh4.googleusercontent.com/xCcz1mlMPqLWUPBe2P_9bhWT_ifKzRvhYERe-BWBzpXtdSISK505KN8gfLCFGhBQ6suw6nJGp0olBm8Y3N7HOSA2DtGVJTPql3zFbQ8y2MC29tMQ15EwRY-C0qDKHWdYeWEs1vDDBu-Of0IREwHNpWeRVgLUCCroCfYQbXR3bDZdIa3Q7gamZBP1wg)

Now the trophy would only appear visibly next to the PC if `session.have_trophy` was equal to `TRUE`. And, because the movement animation had been applied to the Container both the PC and the trophy shared, I did not need to define any more animations to account for it.

![](https://lh6.googleusercontent.com/iIT3Za-8PG27vva1EeHDG5knhNiUS9CjFeaWmQErpQd_HGk6UjexnoAvVmdV9O8OX3h-LRw_OvnU-wpufI32yHgmFLtaEVoFprS6yKLP4Hx_DScVrsVLX_iKHyQWNBip6FjxwJZpbOE5GqFr4VXqOMgF9uzxeRGT89UHAkOtfMq4FExUbNl2BsmQDw)

*(Pictured: A fancy cat doing a fancy dance with their new Cat Trophy. By this point, I had changed the colors of the buttons for aesthetic purposes.)*

## Key Insight: There’s a lot you can do when you track interactions with Booleans

Once I started tracking whether or not my PC had earned their trophy with the simple `Boolean` **have_trophy**, I realized I could do two extremely powerful things:

1.  Interact differently with objects or other characters based on the variable’s value.
    
2.  Render images visible or invisible based on the variable’s value.  

These two things applied no matter what variable I made or what interaction I used it to track. I used these principles to create new ways for the PC to interact with their environment. Soon, my PC could do all of the things real cats can do: destroy a plant, hide in a box, and cast spells. Some of the Airscript expressions grew lengthy, but the underlying logic was always the same.

# Conclusion

By this point, the 48-hour period I had given myself to build out this game was drawing to a close. I added a little more polish – an opening Web Page so that each player could name their PC something different, a Web Page that allowed players to crown their PC upon becoming Cat King – and then my work was done.

Given that Airkit isn’t a video game creation platform, I was quite happy with the end result. The tools Airkit provides might be structured with particular use cases in mind, but they’re also versatile enough that I was able to work around any out-of-the-box functionality that didn’t fit my use case, and I made much more progress in this 48-hour period using Airkit than I would have if I had tried to construct the same game from scratch.

While the gameplay was relatively short and simple, in a way, this worked to my advantage: after my 48-hour flurry of artistic verve, I was excited to show of my creation, and the fact that a single playthrough didn’t require much time commitment meant that it was easy to coax everyone into giving it a try.

![](https://lh5.googleusercontent.com/8yt5Kv8ykL8iBzPZLOnM-hzLsRN3yj8lREPWGEndbE0AdQqiO621PoEamQIRZsYqHWt9p4J5Tx-aTYzrbvrjwPuwNap7_BntaTrCedIedlFT9fAtoG2bZzCnFQlImT25Vj719fRXCg76BxeyWiKg2H45m213jfBEFlsuUbZVxqnpQDncFpcMKCX-2A)

*(Pictured: My cat, after having been forced to sit through the dozenth playthrough of Cat Trophy Kingdom. He just became Cat King again!)*