This tutorial will show how to capture date and time from a PC ou mobile device and insert this data in your C2's project.
What is required?
You need to insert in your project the Browser object and to use the expression ExecJS("Date()").
The code always returns in the fomat Abbreviated Weekday, Abbreviated Month, Day of the Month, Hours:Minutes:Seconds.
How to use
You can to store date and time in a local or global variable using the action Set value and the expression Browser.ExecJS("Date()"). You can to show directly in a Text object with the action Set text.
Both in the Scirra Arcade as in the CAPX attached in this tutorial there is a simple example using the expression. Only 2 events were used:
The example shows continuously the current date and hour every second.
For now, if you need to capture only date or time, use system expressions such as left and right.
Note: AllanR told me about the plugin of rexrainbow, System date and time. You can use it instead of this tutorial.
Unlock your full gamedev potential
Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!
Plus, it's got a lot of additional features that will help you save time and make more impressive games!