Ribis's Forum Posts

  • I solve this problem:

    AJAX, request project --> jsonfile

    load tilemap from ---> AJAX.LastData

    somebody know if this method will work with the iphone?

    thank you

  • Hi everybody,

    I start to use a Tilemap, I think is the best way to make a good performance on mobile.

    My idea it's like that, I have 3 tilemap with 700 width. These tilemaps are a collision of the player.

    I need, when the player.X is on a specific number layout.X, to load a new tile to one of my tilemap.

    now, i tried to make a file.json like that:

    {"c2tilemap":true,"width":24,"height":62,"data":"328x-1,12,3x0,11,19x-1,14,3x-1,13,19x-1,14,3x-1,13,16x-1,12,10x0,13x-1,14,17x-1,3,4,5x0,13x-1,3,2x1,4,2x3,15x-1,3x0,3,738x-1,65,66,19x-1,65,3x66,18x-1,65,3x66,18x-1,65,2x66,21x-1,2x65,66,22x-1,4x65,66,22x-1,5x65,120x-1"}

    I saved this file in "files" folder, but now I can't load my map...

    is possible to load the json file from the folder of the project? is work on the iphone/android? and how?

    Thank you

  • Hi everybody, I start to use a tilemap to make a maps...

    I have different tile with different collision (for the angle of the player) when the event need to set the angle to 0 is not working... and the tile number will be -1?

    this is the example

    I don't understand why is not working with the tile number 20... the other tile works!!

    thank you very much

  • Hi Ribis,

    thanks, I also think that the C2 facebook plugin does not work with Android, it need a lot of programming and I do not have the ability to program a script and unfortunately there are not any tutorial step by step.

    For this reason I suggest to study javascript and start with easy tutorial on the web... but maybe construct2 will support this in future...

    for me is very important to have a social connection with facebook or something

  • Thanks for the reply, but I am able to run the facebook login on my website (aspx page with ajax), my problem is to run the facebook login on mobile/phone, for example on Android after creating the app with crosswalk (https://www.scirra.com/tutorials/809/how-to-export-to-android-with-crosswalk).

    I also created a job to request the intervention of someone (http://www.scirra.com/forum/facebook-login_topic85195.html)

    Thanks a lot and best Regards.

    I never try to export for android or iOS with the plugin of facebook... but I think the plugin of facebook doesn't working with the mobile, but I'm not sure about that...

    The app need to communicate with the app of facebook maybe (different way from the computer)

    maybe, you can insert to the final app some script to intagrate facebook...

    when the XDK export the app, you can open the app and edit or insert a new script? and maybe you need to use GET remote data in construct2...

  • EDIT: for the canvas url insert the index.html with "?" like index.html?, mine works with /index.php?

    and someone will find it useful for this problem:

    when you open your index.html, you need the permission of the user to use some information of the user... in other way, facebook need to know what will do your app with the user information...

    when you make a facebook app, you need to edit your index.html with some code of php.

    Save your index.html in index.php, and add this code before the "<!DOCTYPE html>"

    -------------------------

    <?php

    session_start();

    require 'client/facebook.php'; ///API OF FACEBOOK

    $app_id = "***************"; ///INSERT YOUR...

    $secret = "****************"; ///INSERT YOUR...

    $app_url = "URL OF YOUR APP"; ///INSERT YOUR...

    // Create our Application instance

    $facebook = new Facebook(array(

    'appId' => $app_id,

    'secret' => $secret,

    ));

    // Get User ID

    $user = $facebook->getUser();

    //Do we have a user?

    if(!$user) {

    $loginUrl = $facebook->getLoginUrl(array('scope'=> 'offline_access', 'read_insights', 'publish_stream', 'user_about_me', 'user_likes', 'email','redirect_uri'=> $app_url));

         

         echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";

        } else {

              try{

                  ?//Proced knowing you have a logged in user who's autenticated

                  ?$user_profile = $facebook->api('/me');

                  ?$name = $user_profile['name'];

                  ?$id = $user_profile['id'];

                  ?$first_name = $user_profile['first_name'];

                  ?$last_name = $user_profile['last_name'];

                  ?$link = $user_profile['link'];

                  ?$username = $user_profile['username'];

                  ?$gender = $user_profile['gender'];

                  ?$locale = $user_profile['locale'];

                  ?$email = $user_profile['email'];

                  ?

                  ?

              } catch (FacebookApiException $e) {

                  ?echo ($e);

                  ?$user = null;

              }

    }

    ?>

    -----------------------

    you don't need all of this code in your case, but if you insert this maybe will work... I achieved this when I need to save the information in my database with the php... with this, you don't need the plugin of facebook, because you can get some data from the AJAX.

    let me know if you resolve the problem, now I not have so much time to reply and I don't speak english very well

  • I think a lot of users would love to be able to integrate facebook smoothly in their Android and iOS (and 'insert other OS') games.

    The way it's done now, as far as I know, is trough cocoonJS with the help of ClayIO... so you have an extra login to do. A messy, difficult workflow which a big part of the Construct 2 users struggle to accomplish (myself included). And a negative impact on revenue.

    Would be so good to have a smooth way to do this from inside Construct 2.

    I never try to export CocoonJS, but I integrate my project with facebook with the plugin of facebook to get the UID, and use the php and mysql to save data use for everything...

    I don't know how works the export for iOS, but maybe users need to authorize your application to access on facebook in their iphone.

    and actually I don't know if with your app you can send information to a page on internet to save or send some data...

    if you can use AJAX in your CocoonJS project and access to external script with the iphone will be easier...

    someone know my doubts?

  • Hi all,

    I'm making a game online... and I make a method to save the data of user in my database, actually every user can save like 70 variables and load in the game.

    this working fine, but I think what happen if I would like to save the position and the variable of the object in the map.

    I'm thinking to save the important variables in the database (level, health...etc) and the position of the object in the JSON file (or in local?)

    but if someone clean the cache of the browser it's a problem, and I can't make 6000 records for each user in my database, will be crazy...

    so, another idea it's to save a JSON file in the server, like,

    if the user save the game, the string of JSON will send to a php, the php will make a file .JSON with the name of the user in a specific folder.

    if the user load the game, scirra will load the json from the same folder with the same username.

    this idea can work? 6000 records it's a lot for JSON file? I have another problem for save a items... every sprite has 5/6 variables and if i will save on database i need to make another 100 records (it's not a big problem...but if exsist something better is good to change this)

    thank you very much

  • I can't open the file (I need to register on the website...) but you can compare a "distance(sprite.X,sprite.Y, sprite2.X,sprite2.Y)"...

    for example, if you like to make some event if some sprite overlapping but more close, or in different position, you can compare the distance....

  • I guys can someone help me here??

    see i have 3 options in my game...

    the player can start a new game from scratch

    the player can save and load the game

    and i have an option to go back to me main menu... the thing is...

    what can i do if the player starts a new game after loading the game once or after playing for a while.. becuase the variables and the progress overall (doors unlocked, walls destroyed, items collected, etc etc) will be already done if the player starts a new game. what can i do to reset ALL to default when the player choose click start new game??.

    i was thinking to make a save when the menu shows up... and if the player clicks on the option "go back to main menu" load the state that i saved later to set everything to the way it was when the game started... but... what if the player deletes that save slot from the game's documentation?? i dont have a clear solution to this... <img src="smileys/smiley5.gif" border="0" align="middle" />

    what its the proper way and good tips and recommendation you can give me???

    i dont want to force the game to be close... only to be run again to go back to the original state...

    Thanks!!!

    <img src="smileys/smiley2.gif" border="0" align="middle" />

    I don't know, but you can reset the variables if the player click "new game" or "reset" in the options while the player is playing the game, and after this action make a fast savegame to replace the new variables...

    About the savegame, I resolve the general problems to save in my database (online) to save all data of the player. if the player like to reset the game, construct2 will reset all of the variables and will save in the same row of the database. you need to make some "loader" before the game start, because you could make some bug...

  • Ribis - get the text you want with ajax, then separe a value that you want for each variables

    example:

    1? - Request a text "100|1|2|" from an url using Ajax

    2? - On Completed Ajax Request

       - Then set "Healt" variable value to tokenat(AJAX.LastData,0,"|")

       + set "Point" variable value to tokenat(AJAX.LastData,1,"|")

       + set "Level" variable value to tokenat(AJAX.LastData,2,"|")

    thank you, is working perfectly, with this I make my script better than before, but I have another question, if I have one text like this:

    100|20|0|0|0

    200|50|20|0|0

    90|10|20|20

    it's possible to organize the variable for the newline? I mean, with this I have to make 5 text and I made 5 different file in php... if I can use one text line for all of my variable will be perfect, because I will use just one file in php... I can use the same method for one line, but if in the future I add something in my database i need to edit all order, would be a little bit confused...

    Thank you very much again

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • from the php file, I can load a value from the database.

    when the php file generate the value, I can load in construct2 with AJAX and show the echo in my project.

    so, if I use "|", like:

    10 | 100 | 1 | 2 |

    how i can set the variable in construct2 like this:

    healt: 100;

    point: 1;

    level: 2;

    etc..? I don't know how i can do in construct2...

    thank you very much

  • Hi everybody,

    I have a frustrating problem about how I can load a single row from my database in my array to set the different value in specific variable in construct2...or with a differen method...

    Actually, I can show in contruct2 all of the value from the row in the database like this:

    "10""100""300""10""300""...ecc

    or:

    '10'200'300'400... ecc,

    when I load in construct2 with AJAX, I don't know what I can do to use a single row for set all of the variable in construct2...

    somebody have some idea? construct2 can recognize a single value from "" for example?

    Thank you very much

  • In the How do I FAQ, section AJAX :

    How do I pull variables out of a PHP page using AJAX ? - LINK

    In the tutorials:

    AJAX example with Construct2; Online High Score Table (AJAX, PHP, MySQL).

    thask for the reply, I follow this example but doesn't work, I didn't understand the logic...

    now is working, but if I use the:

    <?php

    header('Access-Control-Allow-Origin: *');

    require 'gold.php';

    echo $gold;

    ?>

    the variable in construct 2 will be "NaN"

    gold.php is this:

    <?php

    header('Access-Control-Allow-Origin: *');

    require 'facebook_login.php';

    ///////////////////

                         ? if ( $loadspecific == "caricadati" ) {

            $query = "SELECT goldDB FROM tabletest WHERE UIDfacebook = $id";

            $result2 = mysql_query(mysql_real_escape_string($query)) or die (mysql_error());

            while($row = mysql_fetch_array($result2))

            {

                  ?//echo "\\";

                

                  ?$gold = "{$row['goldDB']}" ;

                  ?//echo $gold;

                  ?

                  ?//echo $_GET['gold'];

            }

            }else{

                //echo $result;

                }

    ?>

    I start to make a project with facebook... now my project save the data from facebook API in my database and load the single information in the database (gold.php)

    now my problem is load the variable in Construct2 because in php is working

    i'm thinking if the problem is "while($row = mysql_fetch_array" but the echo will be a single number like "1111", but Construct2 doesn't load the variable if I insert require 'facebook_login.php'; <img src="smileys/smiley19.gif" border="0" align="middle">

    the variable is from my database...

  • Hi everybody,

    I made a code in php for save some variable in php, the file is this:

    <?php

    $variable1= 100;

    $variable2 = $variable1;

    ?>

    I know this forum is not for php, but the problem is when I try to read the variable in construct2 with ajax because i don't understand the logic of construct 2.

    i need to set one variable in construct2 with a $variable2 of php file.

    the file:

    .capx

    .php file

    thank you so much, I really need to understand that, actually i spent 4 hours for that <img src="smileys/smiley19.gif" border="0" align="middle">