Why is the game does not start with localhost?

Discussion and feedback on Construct 2

Post » Mon Mar 26, 2012 8:21 am


Why is the game does not start with localhost?



But starting with the hosting is excellent.

Help may be in the code in index.html need to change something?

Here is the complete code of index.html

<!DOCTYPE html>
<html manifest="offline.appcache">
<head>
    <meta charset="UTF-8" />

<!-- This ensures the canvas works on IE9+. Don't remove it! -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<title>Modi</title>
<!-- Note: running this exported project from disk may not work exactly like preview, since browsers block some features on the file:// protocol. Once you've uploaded it to a server, it should work OK. -->

    <!-- This outlines the canvas with a black border and makes the page background black. -->
<style type="text/css">
    canvas { border: 1px solid black; }
    body { background-color: black; color: white; }
</style>

</head>

<body>
<div id="fb-root"></div>
<div style="text-align: center;">

<script>
// Issue a warning if trying to preview an exported project on disk.
(function(){
    // Check for running exported on file protocol
    if (window.location.protocol.substr(0, 4) === "file")
    {
      alert("Note: browsers have very strict security limitations on pages viewed from disk. This means exported projects generally don't work when run from disk. Upload your project to a server, or just preview from inside Construct 2, to check it works.");
    }
})();
</script>

        <!-- The canvas the project will render to. If you change its ID, don't forget to change the
        ID the runtime looks for in the jQuery ready event (above). -->
    <canvas id="c2canvas" width="640" height="480" oncontextmenu="return false;" onselectstart="return false;">
            <!-- This text is displayed if the visitor's browser does not support HTML5.
            You can change it, but it is a good idea to link to a description of a browser
            and provide some links to download some popular HTML5-compatible browsers. -->
      Your browser does not appear to support HTML5. Try upgrading your browser to the latest version. <a href="http://www.whatbrowser.org">What is a browser?</a>
      <br/><br/><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Microsoft Internet Explorer</a><br/>
      <a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br/>
      <a href="http://www.google.com/chrome/">Google Chrome</a><br/>
      <a href="http://www.apple.com/safari/download/">Apple Safari</a><br/>
      <a href="http://www.google.com/chromeframe">Google Chrome Frame for Internet Explorer</a><br/>
    </canvas>

        <br />
    
    <!-- SCIRRA LTD LICENSE AGREEMENT
       FREE EDITION USERS ARE NOT ALLOWED TO REMOVE, MODIFY OR HIDE THE FOLLOWING
       LINES OF HTML5 CODE FROM THEIR EXPORTED GAMES. REMOVAL, MODIFICATION OR
       ATTEMPTS TO HIDE THIS MESSAGE WILL BE IN BREACH OF THE FREE EDITION LICENSE
    -->
    <!-- End of Scirra Ltd. free edition limitation -->
    <a href="http://www.scirra.com" target="_blank" style="font-family:Arial;color:DodgerBlue;" title="Create games">Made with Construct 2 the HTML5 game maker</a>

</div>

<!-- Pages load faster with scripts at the bottom -->

<!-- Construct 2 exported games require jQuery. To save bandwidth, by default
this is set to grab it off the Google content delivery network (CDN). Fall back to local if not available. -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='jquery-1.7.1.min.js'>\x3C/script>")</script>



    <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.
    This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
<script src="c2runtime.js"></script>

    <script>
    // Start the Construct 2 project running on window load.
    jQuery(document).ready(function ()
    {
      // Create new runtime using the c2canvas
      cr.createRuntime("c2canvas");
    });
    </script>
</body>
</html>
B
4
Posts: 19
Reputation: 488

Post » Mon Mar 26, 2012 9:20 am

@AlbertAkefoul
But you don't seem to be running your game from localhost.

Your URL should be http://localhost:50000 (which happens automatically when you click 'Run layout'), not file:///X:/home/localhost/...

(And this is not a website issue - probably should be in 'How do I....', mods.)Velojet2012-03-26 09:25:08
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Mon Mar 26, 2012 9:48 am

I just want my game to make application for ANDROID
I did everything as they say here: http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

have only exported to PhoneGap

When exporting to PhoneGap


out



I do not understand how to change the project properties?
Tell me how to make an application under ANDROID?AlbertAkefoul2012-03-26 09:51:13
B
4
Posts: 19
Reputation: 488

Post » Mon Mar 26, 2012 11:08 am

@AlbertAkefoul, the first error is nothing to do with localhost, you need to upload your project to a server for it to work. See in the address bar it says "file:///". Projects generally don't work on file:/// - that's what the message is warning you about.

The second error is because you need to set a description and version in project properties.

The tutorial you linked to for building with PhoneGap will not work with Construct 2. Use this tutorial instead: How to make native phone apps with Construct 2 and PhoneGapAshley2012-03-26 11:09:41
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544


Return to Construct 2 General

Who is online

Users browsing this forum: TRMG and 14 guests