mekonbekon's Forum Posts

  • It's hard to say what's happening without seeing your event sheet or debug output - are you using two separate array objects, one for each array file?

    In C3 you can load multiple arrays from files in sequence as follows:

    On start (or function, or whatever):

    AJAX: Request array1.json tag "array1"

    System: Wait for previous actions to complete

    Array1: Load from JSON string AJAX.LastData

    AJAX: Request array2.json tag "array2"

    System: Wait for previous actions to complete

    Array2: Load from JSON string AJAX.LastData

  • I also had this issue with 9-patch the other day. The problem with scaling a 9-patch by changing the height and width is that the corners & edges will keep to the preset margin values. Instead I dealt with it this way:

    1. Pin the image to the 9-patch

    2. Set the image pin behaviour to include pin Z-elevation

    3. Add the tween behaviour to the 9-patch

    4. On touch/release tween the z-elevation value of the 9-patch

    The additional benefit of using this method is that you can use the tween ease settings to easily create some nice scaling effects.

  • In event 1 the choose expressions for the sound and tag won't necessarily pick the same name.

    Instead, set a global or local variable e.g.:

    On start:

    set pick to choose("eraser","pencil","ruler","scissors")

    Play pick (tag pick)

    This will ensure your sound and tag match.

  • A. The default animation frame speed is set to 5. Can we change that to 0? Or at least get a setting in preferences?

    Yes please! This has bugged me for ages - I find it very rare to require a speed of five and about half the time I need it at 0.

  • Note, that this code can create 2 or 3 instances of the same sprite. If you need to create 3 different sprites, it's a bit more difficult.

    This is made a lot easier with the Advanced Random plugin, which allows you to create permutation tables.

    I've included three ways of doing it in this demo:

    dropbox.com/s/kkcz7fhjn7ppt26/pickNrandomObj.c3p

    1) Spawn a random family member - this has the benefit that you can use non-numbered sprite names, but can result in repeats.

    2) Use a permutation table to pick a numbered sprite - no repeats.

    3) Use a permutation table and an array loaded with the family member names to pick a non-numbered sprite - no repeats.

  • Here's a simpler function map example that hopefully is a stepping stone to the official example:

    dropbox.com/s/z7ukfyh1tmgkf1l/functionMap.c3p

    In the official version they add in two other steps:

    A parent function ("CallColor") that allows you to pass parameters to the function map.

    A "Default" function in the function map that will catch any calls that don't match with any functions in the map.

  • No worries - glad you're corona free, get well soon! :-)

  • Good catch! Thanks for the feedback, I've fixed and updated the demo link.

    It's been a while since I looked at this and in doing so I also found another issue: it used to be the case that if you clicked on an empty tile it would still register as being over the tilemap, but a while back (after me posting this demo) this changed so that empty tiles no longer trigger as over. I've updated so that left clicks work again.

    Also the tile update was repeating whilst the mouse button was down, even if you were on the same tile - I've adjusted the code so it only triggers once whilst on the same tile.

  • No worries, glad you're able to make use of it. :-)

    If we ever get the ability to make addons out of events I'd certainly have a crack at it - not quite ready to leap into JS! Or maybe Ashley will develop the current in-editor autotiling into tilemap actions that work at runtime...

  • You're welcome :-)

  • It sounds like you need a bitwise tilemap solution. Here's an example of a full blob 8-bit autotile I did a while back:

    construct.net/en/forum/construct-3/general-discussion-7/full-blob-8-bit-auto-tile-126352

    but if you do a fourm search for bitwise autotile you should find a bunch of other examples.

  • You might need to put a Wait 0.1 seconds before enabling the group to avoid the on destroyed conditions still triggering in the same tick.

  • You could put the rest of the event sheet's code, aside from that in the on start event (or just the code with the on destroyed conditions) in a disabled group and then enable the group at the end of on start.

  • This example spawns a random object every X seconds whilst the mouse is down:

    dropbox.com/s/tym974m11mnkba3/spawnRandomNoPattern.c3p

    This example spawns a predefined pattern of objects:

    dropbox.com/s/pb0e095cb3bgqha/spawnPattern.c3p

    If you're going to have lots of different spawn patterns I'd use an array or dictionary rather than string variables to store the patterns.

    This example generates a new random pattern each time you click the mouse:

    dropbox.com/s/72dodyqh90hq4cu/randomSpawnPattern.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem :-)

    int(random(maxSpriteNo))+1 returns a random number of sprites to spawn and works as follows:

    -"maxSpriteNo" is the maximum number of sprites you want to spawn.

    -"random(maxSpriteNo)" generates a random float between 0 and maxSpriteNo, not including maxSpriteNo.

    -"int(random(maxSpriteNo)" removes any numbers after the decimal point of the randomly generated float, returning just the whole number - it's important to note that "int" doesn't round up, so 0.999999 will still return 0.

    -By this stage we will have whole number between 0 and maxSpriteNo-1, so we add 1 to provide a number between 1 and maxSpriteNo.