Pilfer's Forum Posts

  • 4 posts
  • You could try to apply force upwards on collision with the boundary sprites you specify. I also did a check to see if the X coord was < 200, so it's a little more realistic.

    http://dl.dropbox.com/u/17612316/example/bouncy_ball.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • <img src="http://arch.413chan.net/okay-%28n1309292109883%29.jpg" border="0" />

  • Hey there - not sure if this has been mentioned or not, but would it be possible to get a subforum in the C2 category for plugin development?

    It may even help you guys out if we can do some of the programming for you so long as we have a designated place to discuss & debug.

  • Yes there is - I had a similar problem a couple hours ago.

    Check out the ajax tutorial here:

    http://www.scirra.com/tutorials/61/ajax-example-with-construct-2/page-1

    Say you wanted to request savescores.php - you would need two pass two values in - one being the username for identification purposes, and the second being their score.

    The PHP would look something like:

    <?php
    
    /*
         You will need to create the database, then create the "scores" table by running the SQL query below.
         
         CREATE TABLE `scores` (
         `id` INT NOT NULL AUTO_INCREMENT ,
         `name` VARCHAR( 20 ) NOT NULL ,
         `score` INT NOT NULL ,
         PRIMARY KEY ( `id` )
         ) ENGINE = InnoDB;
    
    */
    
    $db = "your_database";//Your database name
    $dbu = "yourdb_user";//Your database username
    $dbp = "yourpassword";//Your database users' password
    $host = "localhost";//MySQL server - usually localhost
    
    $dblink = mysql_connect($host,$dbu,$dbp);
    $seldb = mysql_select_db($db);
    
    if(isset($_GET['name']) && isset($_GET['score'])){
    
         //Lightly sanitize the GET's to prevent SQL injections and possible XSS attacks
         $name = strip_tags(mysql_real_escape_string($_GET['name']));
         $score = strip_tags(mysql_real_escape_string($_GET['score']));
         $sql = mysql_query("INSERT INTO `$db`.`scores` (`id`,`name`,`score`) VALUES ('','$name','$score');");
         
         if($sql){
         
              //The query returned true - now do whatever you like here.
              echo 'Your score was saved. Congrats!';
              
         }else{
         
              //The query returned false - you might want to put some sort of error reporting here. Even logging the error to a text file is fine.
              echo 'There was a problem saving your score. Please try again later.';
              
         }
         
    }else{
         echo 'Your name or score wasnt passed in the request. Make sure you add ?name=NAME_HERE&score=1337 to the tags.';
    }
    
    mysql_close($dblink);//Close off the MySQL connection to save resources.
    ?>
    
    

    EDIT: To retrieve the scores, just run mysql_fetch_array (or object, depending on your preference) and loop through the returned results. It's up to you for how you want them displayed. I suggest doing an ORDER BY `scores`.`score` DESC LIMIT 10 query so you can do a "Top 10" leaderboard.

  • 4 posts