mekonbekon's Forum Posts

  • ankas

    There are a couple of things going on here:

    1) When the project starts, sometimes mouse x,y will be registered as 0,0 (I think this is when the mouse is out of window at the start). Even if it isn't there is likely to be a displacement between mouse x,y and body x,y.

    2) All those limb objects have the physics behaviour on them, so when Body is moved in the start of layout event they all suddenly get an impulse applied, which immediately propels them towards the target. This impulse continues in subsequent frames, shooting the whole ragdoll off the screen. Try disabling all of the "Create Physics revolute joint" actions at the start and you will see that the impulse is eliminated.

    The easiest way to fix this would be to shift the "target|Set position" and "body|Set position" actions above the "Create Physics..." actions and to swap the mouse co-ordinates for a fixed screen position.

  • PLOLWA

    You can shuffle a 1D array using this technique, using only one event and a local variable:

    https://www.dropbox.com/s/thbz3x5ze4lhy ... .capx?dl=0

    I've included annotations explaining how it works. Press any key to shuffle. Event 3 does the actual shuffle, the rest is just setup.

    You can adapt it for a 2D array by nesting the loop:

    https://www.dropbox.com/s/h8pmfmjgfkvu8 ... .capx?dl=0

    If you want to shuffle every X seconds swap the Keyboard input for an "Every X seconds" condition.

  • UncleHo74

    Thanks for posting your solution, handy to know. It does seem as though something's going a bit squiffy with Set Canvas Size - maybe log it as bug, at least you'll know for sure whether it's working as intended.

  • Looking at your code, pressing P should stop both samples from playing.

    Do you have any music playing before this layout starts? If so that will continue looping and won't stop unless it has the same tags referenced in the code.

  • I typically use this format structure for my 3D json arrays and import using AJAX:

    {

    "c2array":true,

    "size":[2,3,4],

    "data":[ [ [0,1,2,3], [0,1,2,3], [0,1,2,3] ],

    [

    [0,1,2,3], [0,1,2,3], [0,1,2,3] ]

    ]

    }

    C2 seems to be quite happy accepting the newlines (unless I'm misunderstanding you ).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It might be related to the fact that you're declaring the size of your array to be [2,30,30], but the actual size is [2,20,17]. I'm not sure how well it handles missing/empty values either.

    Given that you're using the first X row to define the size of the rest of the data, couldn't you just make it a 2D array of [20,17,1]? You can always use the array.width and array.height values in conditions and actions, and add variables to the array to carry other data, rather than adding it into the array. You can also use the push and insert array actions to add extra values.

  • No worries, glad to help out

  • 1. Create a global called isoCount

    2. On Start set isoCount to iso.count

    3. On iso destroyed deduct 1 from isoCount

  • Hi, I took a look at your code; here are a few suggestions that you might want to consider:

    1) Instead of spawning objects you could use a tilemap and change the tiles to when you click. This would only be a suitable option if you don't intend to animate placed objects (you can animate tiles, but it is fiddly to set up and kills your framerate).

    2) Your code in each object group is essentially the same - you could replace all of these with a single function and instead of having the booleans plantWheat, plantCorn etc just have a single global string variable "plantObject" that you set to the object type. C3 has the very cool action "create object by name", so you can pass plantObject in order to spawn the correct object type.

    3) Alternatively, rather than having individual shop objects and placed objects you could have one shop object and one placed object, and have the different types as separate animations. This would reduce your object count and also allow you to simplify the code.

    Hope that helps

  • Try using "is overlapping" and "every 0.35 seconds" instead of "on collision".

  • Also, your link is bust - copy and paste automatically contracts the link (notice the ellipsis towards the end) - you'll need to post the full link and add a space either side of the periods to stop it contracting again.

  • Stick all the objects that you want to register in a family and then test the mouse over for that family, rather than the individual object types.

  • You're welcome

  • One thing to note when using angles: when you look at sprite in the editor, 0 degrees actually points to the right rather than straight up, so you need to take this into account when using things like the angle(X1,Y1,X2,Y2) function. Check out how I've set up the hippo sprite and its origin in the editor to see what I mean.

  • Hi the_Shit_hawk (nice username - Lahey would be proud! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> )

    I wasn't exactly sure what you were after so I've included two schemes in this demo:

    https://www.dropbox.com/s/umqh6cnvtwuh3 ... s.c3p?dl=0

    Just re-enable the second event and disable the first to switch.

    I've set the hippo to invisible rather than destroy it, which should be a teensy bit faster at runtime - you would probably want to disable the collisions when it's invisible too.

    Hope that helps! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">