How do I use php in Construct 2?

  • Ghengis I love your game "CASH ROLL". <img src="smileys/smiley1.gif" border="0" align="middle" /> What a fun, and addictive game. Did you make all the game art yourself? I'm looking forward to your AJAX tutorial Iv been working on a database, and some php scripts for a social game like FarmVille, and I would really like to use Construct 2 to build it.

  • Ghengis I love your game "CASH ROLL". <img src="smileys/smiley1.gif" border="0" align="middle" /> What a fun, and addictive game. Did you make all the game art yourself? I'm looking forward to your AJAX tutorial Iv been working on a database, and some php scripts for a social game like FarmVille, and I would really like to use Construct 2 to build it.

    Yes, I use to be a an illustrator before I got into programming.

    The next step would be to create a login, member/avatar set up that will post to a leaderboard with achievements, points etc.

    I'll write up the tutorial on the basics of the AJAX object. Then build on that.

    Construct 2 is just an amazing piece of work by Scirra. It is very powerful. I'm so glad I found it.

  • I added a tutorial with lots of screen captures and notations. I hope it helps someone. http://www.scirra.com/tutorials/61/how-to-a-simple-ajax-example-with-construct-2

  • Ghengis, I don't have time to read the tutorial fully but at a quick glance it looks superb, good job!

    Just so you know, you can split it onto multiple pages with:

    ==========

    It's quite a long page so might be a good idea!

  • Ghengis, I don't have time to read the tutorial fully but at a quick glance it looks superb, good job!

    Just so you know, you can split it onto multiple pages with:

    ==========

    It's quite a long page so might be a good idea!

    Thanks for the tip.

    I didn't know I could split up the pages. When I was writing it, I did notice an unusual amount of scrolling on my part. I'll split it up. Things will be neater and it will load faster too.

    *updated didn't to did

  • Ghengis...you totally rock! Thank you.   <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the kind comments everyone.

    I've updated the tutorial as per Ashley's suggestion (it was very handy). I also updated the .zip download.

  • In your tutorial you have the AJAX event as:

    AJAX -> on "" completed... action = txtReturnData -> set text to AJAX.LastData

    But in your capx file it shows instead:

    AJAX -> On AJAX.LastData completed...action = txtReturnData -> set text to AJAX.LastData

  • In your tutorial you have the AJAX event as:

    AJAX -> on "" completed... action = txtReturnData -> set text to AJAX.LastData

    But in your capx file it shows instead:

    AJAX -> On AJAX.LastData completed...action = txtReturnData -> set text to AJAX.LastData

    Thanks for finding that. I've updated the zip file.

    It works either way - at least that's what I found. I'm sure the final version of Construct 2 will have some kind of update or official docs on the stuff we're all using.

    For now, use the "" version.

  • My first attempt didn't do anything.

    .http://www.mypwn.com/ajaxexample/

    I FTP'd your example as well and it GET's the info in the php file...it just doesn't display in the text object.

    .http://www.mypwn.com/ajaxtutorial/

    I'll keep tinkering and hopefully figure out what I'm doing wrong.

  • Same issue for me. BTW how to debug it?

  • droptank21 and Mehtab,

    This is good to know. Can you guys PM me your .capx file. I'd like to take a look. As well, make sure sure that the index.html that gets generated by Construct2 is in the same directory as the ajaxexampleGET.php file.

    If anyone is having issues please PM me, It would be good to know why it isn't working. I will post whatever I find.

  • My first attempt didn't do anything.

    .http://www.mypwn.com/ajaxexample/

    I FTP'd your example as well and it GET's the info in the php file...it just doesn't display in the text object.

    .http://www.mypwn.com/ajaxtutorial/

    I'll keep tinkering and hopefully figure out what I'm doing wrong.

    I just checked your c2runtime.js file. It is showing my domain vs. yours. You should change:

    jtadeo.com/scirra/ajax/ajaxexample1/ajaxexampleGET.php

    to

    mypwn.com/ajaxtutorial/ajaxexampleGET.

    This is a crossdomain issue.

  • capx sent

  • I fixed the cross domain issue. Your example works now. Now to fiigure out what the heck I did wrong, lol. <img src="smileys/smiley5.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)