Sestenes's Forum Posts

  • Sestenes, xDevWizx - Does the method will gives negative effect to the performance (if you use too much tiles of sprites)?

    I doubt it affects performance much either way. For the most part, it's still just a single asset being repeated over and over.

    The way I do it is to go to View, and check Snap to Grid and Show Grid, and then set my Grid Width and Grid Height to half of the size of my tile. I choose half because otherwise the tiles will snap in to the center of the tile-section, and half of them will spill out of layout on the edges. If you choose half, then each of your tiles will cover a 2x2 grid of tiles, and you can line them up perfectly.

  • Derqs Thanks for the camera tutorial - great stuff. And your game looks better and better! I think the simple concept of town, dungeon, boss is wonderful. You really have something special here. Can't wait to try a demo!

  • The art is great, and the music fits pretty well, but I would either slow the game down a bit (maybe slow it down A LOT, but increase speed as you progress), and/or give the player fewer options at first, so that it is easy. I'm not saying the game should be easy, but the beginning should be, so that the player can become acquainted with the mechanics.

    Very slick presentation though. Lots of potential here.

  • This looks like a lot of fun. Love the old school 2D art and mechanics. How did you pull off the smooth camera, if you don't mind me asking?

  • I've run into this problem as well. I just avoid using tiled backgrounds entirely. I just use a regular sprite and copy it as needed to tile (easy if you are using a snap-to grid layout). Or draw my backgrounds in their entirety in something like Photoshop and then slap them on a BG layer. Maybe using tiled backgrounds is more efficient, in terms of space and/or performance, but they seem a bit buggy to me.

  • Nevermind, I figured it out. I didn't realize you needed to load the keys in the dictionary ahead of time.

  • I have found my error which was in the sintax of the dictionary c2 uses.

    Care to shed some light on that syntax?

  • I'm trying to figure this out too. I'm not sure what the correct php syntax is for formatting the json_encode() so that I can scoop it up into a C2 dictionary object.

  • Thanks ramones I know about that forgot to include it in my post but the problem was the format of the array after theubie's post i looked at php.net about json_encode the php needs to be formated in a certain way for json to encode it as I wanted.

    Thanks for both responses.

    The soloution is when building the array you have to put it into an array like so

    $json_data = array();

    while ($row = mysql_fetch_assoc($sql)) {

       $json_data = array(array(array(FIRST BIT OF DATA)), array(array(SECOND BIT OF DATA)), array(array(NEXT BIT OF DATA)), array(array(AND SO ON)));

    }

    $json_data = json_encode($json_data);

    echo '{"c2array":true,"size":[4,1,1],"data":';

    echo $json_data;

    echo '}';

    this example will ouput for a 4 x 1 x 1 array that with a json load in construct 2 will work and load your data in for you.

    Sorry localboss did not see your comment there till i come to edit this must have been typing my original out as you commented thanks for the suggestion i have managed to solve this now ace53422013-02-18 21:31:29

    I have scoured this forum for this solution for days now - thanks so much for sharing!

  • I posted this on your other thead but wanted to reply to this one as well.

    Make sure your encapsulating the php array in the format that the C2 array is expecting.

    >  $myArray = array();
        $myArray[] = 4;
        $myArray[] = 3;
        $myArray[] = 1;
        $myArray[] = 3;
        $myArray[] = 1;
    
        $output = array(
    	'c2array' => true,
    	'size' => array(
    	    0 => count($myArray),
    	    1 => 1,
    	    2 => 1
    	),
    	'data' => array()
        );
    
        $x = 0;
        foreach ($myArray as $value) {
    	$output['data'][$x] = array();
    	$output['data'][$x][0] = array();
    	$output['data'][$x][0][0] = $value;
    	$x++;
        }
    
        return json_encode($output);
    [/code:2hjte4hn]
    
    The resulting JSON string would look like this :
    {"c2array":true,"size":[5,1,1],"data":[[[4]],[[3]],[[1]],[[3]],[[1]]]}
    
    You can now take this string as is and load to the Array in C2
    

    How would you format your json_encode($output) if all you want to do is return, say, five name/value pairs?

  • I am having a similar issue. I'm not sure how to convert an AJAX request into an array and pull the data from it. I want simple name value pairs, so I assume I want a 2D array. The file that the AJAX request is sent to works fine when all I do is echo a single variable and set it to a variable in C2, but when I try echoing an array, such as:

    header('Content-Type: application/json');
    	$output = array(
    		'c2array' => true,
    		'error' => false,
    		'userID' => $ID
    	);
    	echo json_encode($output);[/code:fr0da6hw]
    
    and capturing it in C2 with AJAX On "tagname" completed -> Array Load from JSON string AJAX.LastData, I get tripped up. I assume that I'm either not loading it to an array in C2 properly, not setting up my array in C2 properly, or I just don't know how to pull the data from the C2 array properly.
  • Wow, that's embarrassing. Thank you very much for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [attachment=0:2jrtvksb][/attachment:2jrtvksb]

    I understand how to install the plugin - I can interact with it inside of C2. I guess I'm just at a loss for how to get it to work. Is it as simple as setting the value of a variable to CBhash.MD5("data"), or do I need to prime that variable somehow? Does the plugin need to be initiated in any way? There must be something I'm missing.

  • I just updated to the latest version of C2, and I also just downloaded the version of the MD5 Hash plugin that I found in the first post of this thread, and I'm getting no love. Is there a more recent version of the plugin I should be using?

  • I've been looking for a way to do this for some time now. I kept seeing something about "jump sustain" - not sure if that was in Construct Classic or what, but this trick works for C2.