Facebook Twitter

Offline games in Construct 2. Construct 2 games work offline.

Offline games in Construct 2

So long as the game has been downloaded once while online, the user can play the game again after going offline. This is great for both iOS web apps and Chrome Web Store hosted apps, since you don't need to be online to play! This tutorial describes how the offline support works and how you can enhance it with features like auto-update. The App Cache file After exporting your project, you should notice a file called offline.appcache in the exported folder. It's important to note when you upload your project, some servers are not set up to serve .appcache files correctly.

If everything is set up right, the browser will save your entire game to disk after loading it for the first time.


Construct 2 r154 (Beta) Download. New this build: a multiplatform in-app purchases (IAP) plugin!

Construct 2 r154 (Beta) Download

Previously it has been difficult to set up IAP in games, requiring different plugins and events for each platform you want to publish to. This plugin aims to eliminate that work, having a single set of events for a single object that handles IAP on whichever platform you export to. The initial release of this plugin has support for the Windows Store, CocoonJS, Blackberry 10, Amazon Appstore, and Tizen. Other platforms are not yet supported, but we will be looking in to adding support for others in future. And when we do, the same set of events should work for that platform as well, making porting a lot easier. There's no documentation for this plugin yet but the basic usage is as follows: On start of layout, use the Add product ID action to add the product IDs you will be using, e.g. HTML5 Games and Touch Games from Overview of the Construct 2 SDK. Third party developers can write their own plugins and behaviors for Construct 2 in javascript.

Plugins have two parts: the editor side (defining the plugin settings, actions and conditions, etc) and the runtime side. The editor side is interpreted by Google's V8 javascript engine built in to the HTML5 exporter. The runtime side runs in the browser. Note the implications: you cannot use browser features in the edittime, and you should not use browser-specific features in the runtime. Javascript is not Java! You do not need any special tools to develop plugins or behaviors. This guide will not teach you javascript. Mozilla's Javascript GuideA complete guide to javascript. StackOverflowAn excellent Q&A website. Javascript GardenGuide to the unusual parts of javascript. Mozilla Developer Network (MDN)An excellent reference for HTML, javascript, and more.

Overview of plugins and behaviors Plugin scripts Plugin and behavior scripts are located at Each plugin has its own folder. Good luck! AJAX object. The AJAX plugin allows web pages to be requested during the running of the game.

AJAX object

Its name derives from "Asynchronous JavaScript and XML", a technique familiar to most web developers. The AJAX object is designed for use by web developers already familiar with the technique - this reference will not describe the principles of AJAX itself, only how to use it in Construct 2 with the AJAX object. Generally using the AJAX object also requires custom server-side scripting which is beyond the scope of this manual. How to make a request The basic usage of the AJAX object consists of: Use the Request action to load a URL.A moment later after the request completes, On completed triggers.The LastData expression can be used to access the content of the response. The tokenat system expression may be useful to split simple responses. Tags A different tag can be provided for each request. Making AJAX requests cross-domain or in preview By default, browsers block AJAX requests across domains. In node-webkit. AJAX Example with Construct 2.

Construct 2 has an AJAX object that will allow you to make a request to a target page in order to return the resultant data to AJAX.LastData where we can use the information collected.

AJAX Example with Construct 2

In this tutorial I'm going to show you:1. How to set up a simple interface that can form as the boilerplate for future tutorials.2. How to set up a simple php file (we can also use a simple .txt file)3. How to connect the AJAX object to make a call to our target page then return it to our HTML5 page. If you are already familiar with Construct 2, you can skip step 1. Here's an example of what we're going to make: It's located at: If you click the image, it will do the following: