Yann's Forum Posts

  • Shock bis

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • oh damn, the crazy guy with levels in layers :D

    hmmm I think in event 12 all the thing you do on layers after the 'Go to layout "Game"&Game_Layout' won't be taken into account after you change layout.

    But I can't help more, you're capx isn't easy to understand

  • If you set the instance variable of a particular instance in the property panel at edit time, each time you reload the layout the instance variable of this object will be reset to this value.

    So if you always want the center cat to be selected on start of layout, you just need to set it at edittime.

    Didn't look at your capx though, but if I understood your post well, all your questions have been answered?

  • "2D array to place sprites" I did something like that in cc

    Basically I use only one sprite, with different animation frame which are the object I want to place.

    so I just have to do something like :

    Global variable rows=10 //number of rows for the level grid
    Global variable cols=10 //number of columns for the level grid
    Global variable cellSize = 32 // size of the cells
    System: Start of layout
      System: for "" from 0 to rows*cols-1
        -> System: Create Sprite on layer 0 at ((loopindex%cols)*cellsize,floor(loopindex/cols)*cellsize)
        -> Sprite: set animation frame to Array.at(loopindex)

    You don't really need 2D arrays. If you know the number of columns for each rows you can pretty much count each cells from top left to bottom right.

  • Wronghands

    lerping is fairly easy once you get the hang of it (don't be impressed by the size of the expression... size doesn matter you know :D)

  • patience patience :D

  • I don't think it's possible yet (:

  • Hehe Tiled. I wondered for a moment if we couldn't somehow make a plugin to read tiled map and automatically create the corresponding map.

    I'm still thinking about it.

    Well.. Anyway custom plugins aren't allowed fot the contest v__v

  • Nest the foreach event under the start of layout event

  • bulletAngle.capx

    I simplified the capx, I think it was a bit too early to split all into different eventsheet... always hard to read for others.

    Well anyway it seems the set angle of motion is a bit bugged, I switched to set angle and that works fine (event 30 and 31)

    Oh damn! A big sprite for the whole level?... crazy guy, use tiled background and some neatly splitted sprites (you could event use them for collision detection... 2 birds with one stone)

  • In my opinion you're asking the wrong question.

    But I don't mean to be rude :D

    I see many ways to do what you ask, but all these ways aren't the best way depending on what you want to use your cat for.

    If you want to pick a cat with the mouse and make it do something my solution works well.

    If you want to apply some action on a black cat but not on the other ones, you can use their animation frame or name ('cause it would be different to show differnt colors') to pick them.

    If you want to pick the centered cat, you can compare it's position.

    If you want to pick a cat precisely, amongst the same kind of cats (same graphics) whereever it is...

    First let me say that I don't see the point to be so specific.

    But let say you want to be, you just have to do what Kyat said and assign ID in instance variables at runtime.

    Also, if you want to memorize a picking for later uses. Let say you selected one cat at the start of the game, the cat gets hidden under mugs and the mugs get shuffled (like these street performance you know?) you can maybe store its UID in a global variable at runtime and pick by UID afterward.

    But in this example I would just simply set a boolean to true on this specific cat when you select it.

    Now I hope you understand why I said that you should explain a bit more about your game. We need context to provide the optimal answer.

  • [invert] means that you right click on your condition and you invert it

    It's not the same as "on release".

    On release is a trigger, it is true the moment you release the button.

    But well... In that case it should work th same (:

    And yeah, I didn't know that the deceleration was an issue, nullifying vectorX is the way to go (:

    The or is not yet natively implemented but there's a plugin for that.

    you can also do something like :

    System: Every tick
      Local variable or=0
      Condition1
        -> System: set or to 1
      Condition2
        -> System: set or to 1
      System: or = 1
        -> Do the action

    Using local variable is interesting 'cause it's autmatically reseted each tick. And it won't appear in the list of global variable in the rest of the event sheet ('cause it's local (: )

  • Either you use the same sprite for all your solid, setting the proper animation Frame to display while you edit your level in c2

    Either you wait for families... as some goals were fixed on having something soon.

    read the second paragraphe here http://www.scirra.com/blog/67/early-adopter-period-to-end-soon

    So, as you have almost 2 month for the contest, we might have families soon enough to use them (:

  • Ok then, I had a little go at it

    It's been a while since I last did some php/mysql so there might be some mistake but here's what I came up with :

    Database:

    table user
      - 'id' bigint unsigned auto_increment primary_key
      - 'name' varchar(50) unique
      - 'password' varchar(256)
    
    table games
      - 'id' bigint unsigned auto_increment primary key
      - 'id_user' bigint unsigned 
      - 'log' longtext
      - 'score' bigint unsigned

    connect.php

    <?php
    $username= 'plop';
    $password= 'mystery';
    $server = 'localhost';
    $dbname = 'myDataBase';
    
    $con = mysql_connect($server,$user,$password)
        or die('ERROR: Unable to connect to database: '.mysql_error());
    
    mysql_select_db($dbname,$con);
    ?>

    save.php

    <?php
    #connexion
    include('connect.php');
    #simplification
    $id_user= isset($_POST['id_user']) ? $_POST['id_user'] : '';
    $log    = isset($_POST['log']) ? $_POST['log'] : '';
    $score  = isset($_POST['score']) ? $_POST['score'] : '';
    
    #check if all is ok
    if($id_user && $log && $score)
    {
      #paranoiac escaping
      $id_user= mysql_real_escape_string($id_user,$con);
      $log    = mysql_real_escape_string($log,$con);
      $score  = mysql_real_escape_string($score,$con);
      
      #check if the user exists
      $query  = '
        SELECT name 
        FROM user 
        WHERE id = '.$id_user 
        ;
      $result = mysql_query($query,$con) 
          or die('ERROR: sh*tty request: '.mysql_error());
      
      #if there's a user with this id 
      #we save
      $rows   = mysql_num_rows($result);
      if($rows)
      {
        $query = '
          INSERT INTO games 
          SET 
            id_user='.$id_user.',
            log='.$log.',score='.$score
            ;
        mysql_query($query,$con) 
            or die ('ERROR: sh*tty request: '.mysql_error());
        echo('SUCCESS');
        exit;
      }
      echo('ERROR: Wrong user id');
      exit;
    }
    echo ('ERROR: Missing Data');
    exit;
    ?>

    load.php

    <?php
    #connexion
    include('connect.php');
    #simplification
    $id_game= isset($_POST['id_game']) ? $_POST['id_game'] : '';
    
    #check if all is ok
    if($id_game)
    {
      #paranoiac escaping
      $id_game = mysql_real_escape_string($id_game,$con);
      
      #get the log with the username and the score... always usefull
      $query   = '
          SELECT user.name, game.log, game.score 
          FROM user,game 
          WHERE game.id='.$id_game.' 
          AND game.id_user=user.id
          ';
      $result  = mysql_query($query,$con) 
          or die('ERROR: sh*tty request: '.mysql_error());
      if($rows)
      {
        $row = mysql_fetch_assoc($result)
        echo(
          $row['name']."\n".
          $row['log']."\n".
          $row['score']
          );
        exit;
      }
      echo('ERROR: No game found');
      exit;
    }
    echo ('ERROR: Missing Data');
    exit;
    ?>

    game_list.php

    <?php
    #connexion
    include('connect.php');
    #simplification
    $start    = isset($_POST['start']) ? $_POST['start'] : 0 ;        // start at the begining by default
    $range    = isset($_POST['range']) ? $_POST['range'] : 10;  // return 10 games by default
    #paranoiac escaping
    $start  = mysql_real_escape_string($start,$con);
    $range  = mysql_real_escape_string($start,$con);
    
    #get the list of games from start to range-1
    $query  = '
      SELECT user.name, game.id, game.score 
      FROM user,game 
      WHERE game.id_user=user.id' 
      ORDER BY game.id ASC 
      LIMIT '.$start.','.$range
      ;
    $result = mysql_query($query,$con) 
      or die('ERROR: sh*tty request: '.mysql_error());
    $rows   = mysql_num_rows($result);
    if($rows)
    {
      while($row = $mysql_fetch_assoc($result)
      {
        echo($row['id'].','.$row['name'].','.$row['score']."\n");
      }
      exit;
    }
    echo('Error: nothing');
    exit;
    ?>

    Basically the only thing I didn't do is how to get the id of your user as it's something to do with how you want the user to log in. (session and stuff like that... meh... maybe you just need to call a get_id.php which return something like $_SESSION['id'] which you set in your login page...

    But if you can get the id, basically to save a game you just have to do an ajax POST query with the id, the log and the score.

    If you want a list of saved game, just call the game_list.php with the start (from which game) and the range (how much game) argument.

    What's lacking maybe is a query to get the number of total games but meh... lazy.

    If you want to replay a game, just call the load.php with the id of the game

    You'll get something like :

    username
    score
    x1,y1,a1
    x2,y2,a2
    x3,y3,a3
    x4,y4,a4
    ...

    So you'll just have to strip the string from the two first token (username and score) and then you'll have the log variable back (:

    Oh also if you look closely, all error report are begins with an "ERROR:" so you can check the ajax response and nicely display errors when you encounter them. (it won't be an ajax error but a php/mysql one so the ajax object won't return any error, just the string returned by php... I'm clear... I feel you understand....)

    That's all

  • Keyboard: Down arrow is down
      -> Sprite: Start ignoring Platform user input
    Keyboard: [invert] Down arrow is down
      -> Sprite: Stop ignoring Platform user input