droptank21's Forum Posts

  • <?php

    $db = "database";//Your database name

    $dbu = "root";//Your database username

    $dbp = "";//Your database users' password

    $host = "localhost";//MySQL server - usually localhost

    $dblink = mysql_connect($host,$dbu,$dbp);

    $seldb = mysql_select_db($db);

    if(isset($_GET['username'])){

         //Lightly sanitize the GET's to prevent SQL injections and possible XSS attacks

         $username = strip_tags(mysql_real_escape_string($_GET['username']));

        $query = "select * from user where username='$username'";

        $result = mysql_query($query) or die("User does not exist") ;

        $result2=mysql_fetch_array($result);

        if($result2)

        {

           session_start();

           $_SESSION['username']=$username;

           echo "$result2[id]";

        }

        else

        {

           print 'Wrong username or password.';

        }

        }

    else

    {

    echo "No data input to page.";

    }

    ?>

  • I'm currently building one right now, actually. Along the lines of Eye of the Beholder and Lands of Lore. A game like King's Quest VI or other will require more programming to control the character. I can guarantee though, that you can easily make a 2D point and click. The most challenging part is handling the inventory system, but do a quick search here on the forum and you can easily find a working one utilizing both click and drag and drop mechanics as a basis.

    Here's one by Wastrel Simple Point & Click Inventory

  • Did you change the ajax request url's in the C2 capx to match the url's of the php pages on your web server?

    Example:

    "http://localhost/wwxmmo/login.php?username="& UsernameTxt2.Text & "&password=" & PasswordTxt2.Text

    To

    "http://savvy001.com/wwxmmo/login.php?username="& UsernameTxt2.Text & "&password=" & PasswordTxt2.Text

    Be sure to check the syntax of your ajax code as well. Specifically ensuring there are spaces after the ampersands (&) denoting the data.

    (&_UsernameTxt2.Text &_)

  • You would create a new column in sql for level. Then much as the stats query you would query the user's level and assign the result to a global variable. Then simply assign an event that will check the user's level and set the system to go to one layout for a user and another seperate layout for admin.

    Tinker around with the stats php code and you'll get the hang of it.

  • And, of course, showing them their stats is all well and good. But there also needs to be an easy way to update a stat.

    Here is the php code for that as well...Here

    Then ensure it updates the stats in the game to show the new stat score.

    For example:

    Mouse -> on right button clicks on object 1 -> Ajax -> Post to : "http://localhost/wwxmmo/addexp.php?username="& UsernameTxt.Text & "&password=" & PasswordTxt.Text (tag "addexp")

    Ajax->On "addexp" completed -> Ajax ->Request: "http://localhost/wwxmmo/getstats.php?username="& user

    Ajax-> On "getstats" completed -> [Text]stat1 -> Set text to Ajax.Lastdata

    Simple as that. The user clicks on an object, our game Posts a command to php. Php updates the database. When the ajax command finishes a request is sent to retrieve the updated stat from the database, we assign that stat to a text object and the new stat is then displayed in the game.

  • It wasn't really necessary for the login function. However, I guess since you want a player to login you will need an idea of how to easily show them their own info.

    Here is the link to the getstats.php example.

  • Nice. Perfect for RTS games.

  • Looks fine to me. On Firefox.

  • Even though you go from one layout to the next and then back to the game layout you are still increasing global and instance variables every tick or every x number of seconds. You have to set rules that reset the variables (speed, acceleration, etc.) back to their original settings.

  • System -> On Start of layout : System -> Set speed to 2

    That will reset the speed of the game.

    I am pretty sure there are other parameters for the tiled backgrounds and the acceleration of the sprite16 that should be reset at the start of the layout as well, but still working on it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's always csv files as well.

  • The tricks would be whether the mobile device can run asp and mdb files and finding a way to have the Ajax request point to the database within file structure of the app.

  • Active Server Pages (.asp) and Microsoft Access (.mdb) file.

    Just like sending Ajax POST and GET requests to php and an sql database except the database (.mdb) is stored right in the application files. Then you just add the .asp coding to access the database and run queries like so:

    <%

    Set POwnn = Server.CreateObject("ADODB.Connection")

    Set OSP = Server.CreateObject("ADODB.Recordset")

    ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("db\database.mdb")

    POwnn.Open ConnectionString

    sql = "SELECT * FROM users"

    OSP.Open sql, POwnn, 3, 3%>

    <%=OSP("username")%>

    <%

    OSP.Close

    POwnn.Close

    %>

  • That fixed it. Thank you very much.

  • I found this in the forums http://www.scirra.com/forum/how-do-you-set-text-to-a-global-variable_topic48160.html, but it is only dealing with Construct Classic.

    How can one set text to a global variable in C2?

    <img src="http://dl.dropbox.com/u/44787590/set_text_to_global_variable.jpg" border="0">

    I have a global variable (number) set. on start of layout the system runs an Ajax Request to a php file that returns data from a database for the user.

    On Ajax complete I set the value of the global variable to the returned Ajax.LastData.

    But when I try to set the text block to display the new global variable (every tick) it just shows the text "stat1" instead of the global variable value.

    I have tried setting text to ""& stat1 which displays a NaN error.