Skip to content

07. Things to know

Psycho edited this page Jan 23, 2024 · 4 revisions

There are a few things you definitly need to know before starting with this plugin

Start AirConsole

This is an action you have to use in each and every of your games, once! Use it in the condition called "On loader layout complete", which means your game will initialize AirConsole when it is has completely loaded. No discussion or theory, just use it as the first thing you do!

Game Ready

This is also an action you have to use in each and every of your games, once! This let's the controllers know that the screen is ready. It is a good practice to use this action in a system condition called "On loader layout complete", which means your game will tell your controllers it is ready to play only when your game has completely loaded.

Property name, property value, message ???

Yeah, ok, if you're new, the question is really legit. Controllers and screen communicate together, through messages. A message is technically a Javascript object. Javascript object carry properties that have values. Think of it like that:

You are a person, you are living in a house, you have a pet and you are tall:

let you = {
    livingIn: "house",
    hasPet: true,
    isSmall: false
};

This is a JS object. the "livingIn", "hasPet" and "isSmall" are its properties, and "house", "true", "false" are it's property values. And we do exactly the same with AirConsole, we send message as objects!

airConsole.message(AirConsole.SCREEN, {
    startButton: "pressed"
});

The propertyName of this message would be "startButton" and the propertyValue "pressed". You can even send complex messages, with multiple properties, and even sub properties!

airConsole.message(AirConsole.SCREEN, {
    room: "room1",
    temperature: "22",
    partner: {
        name: "Psycho",
        room: "room2"
    }
});

More to come on this page when/if you have questions

Clone this wiki locally