[Solved] How do I Grab parameters from the canvas page...

0 favourites
  • 3 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • I searched a bit before posting this, but could'nt find anything.. Might have missed it given that i'm amazed at how helpful the documentation and tutorials for construct are..

    I'm using construct in my game as a "match engine" sort of deal, where the entire game interface is separate, except when playing the actual match.

    I need to be able to pass parameters in the URL in order for the construct app knows which match its currently playing and is able to pull the data from the database.

    How do I access URL parameters on the start of the layout from the actual canvas html?

    Thanks....

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Let me elaborate on what i'm trying to do..I want to prototype a racing manager sim (used the simple AI by SeriouslyCrunchy with some modifications as a starting point, thanks btw)...

    Basically, I wanted the actual construct game to only play out the races..

    So I would pass parameters when the race started with driver stats, and car performance, as well as starting fuel for pit stops, etc.

    The entire "management" part to be written with php, but I can't seem to find anywhere where I could get parameters passed on to the actual construct html... Is that possible at all? Perhaps add a javascript function that gets called when the layout is loaded that will pass the parameters?

    Thanks...

    EDIT: Tried posting the URL to the actual construct app but it would'nt let me for low rep... putting it again without the link... thanks

    shifty.com.br/sergio/construct_test

  • In case it helps someone, did it thru webstorage object.

    Rename the app html file to php, and just save it in the jquery call that creates the c2 canvas.

    jQuery(document).ready(function ()
    {			
    	// Create new runtime using the c2canvas
    	sessionStorage.myid= <?=$_GET['id'];?>;
    	cr_createRuntime("c2canvas");
    });
    [/code:bdksjpoc]
    
    Then just get whatever parameters you want in the event editor with webstorage object with expression:
    
    [code:bdksjpoc]WebStorage.SessionValue("myid")[/code:bdksjpoc]
    
    Thanks
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)