mekonbekon's Forum Posts

  • overlimit1 Check again: - the collision box of the first frame fits, but the boxes for the rest of the frames are all set to the full size of the frame, which is why your sprite floats in the air - is there any reason why the frame needs to be so big? If not I would recommend doing the following:

    1) Go through and crop each frame using the crop tool in the editor (hold shift and click the crop icon to crop all frames in the animation) - this will save you a ton of space.

    2) Place the origin point at the bottom of the frame and apply to the entire animation (select the origin icon and right click "origin" in the origin pop-up window to access quick assign to bottom and apply to entire animation).

    3) Make the collision box a rectangle (instead of a polygon) that approximately covers the sprite and apply it to the entire animation - this will help prevent weird collision bugs due to the collision changing between frames/animations.

    An alternative technique is to create a separate invisible sprite that you use for collision checks and pin the other sprite to it - you should be able to find examples of how to do this if you search the forum and the tutorials.

  • aaronfranke Maybe something like this:

    Create a global variable

    For each condition that you're testing:

    when true, trigger once: add one to global variable

    when false, trigger once: deduct one from global variable

    If global variable = 5: do your thing

  • jhjconstruct, oosyrag, jobel, AllanR

    Here's a way to shuffle an array using only a single array and a local variable:

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

    Run it in debug to check the array sorting.

    It works by picking a row from within the array width, pushing it to the back of the array, and then using the loopindex to reduce the number of rows to pick from, until all rows in the initial array have been picked and pushed to the back.

    I've just randomly shuffled, but if you wanted to apply a particular sorting criteria then you could modify event 3.

  • IGDev Also in your example it looks like you have a bug where clicking on the same sprite1 will generate additional lines - or is this intended? If you explain the required behaviour I can have a go at patching it up.

  • IGDev Hi there, the reason your lines widths are changing is because you haven't disabled/deleted event 8, which randomises the the width of any sprite in the "sprites" family; I put that event in to demonstrate how the totalwidth value updates when the widths change - you don't need it.

  • Romalex360 ah, fair point. I'll have a think about it and let you know if I come up with a different solution.

  • This might work (no guarantees though - haven't tested it!):

    Create a new layer called "loader" above all the other layers.

    Add a tiled background that covers the entire window and a sprite with a loading animation to the layer.

    Add a global called lastObjectCount.

    We can now use the system expression"objectcount" to check how many objects have been loaded in:

    Every X seconds if lastObjectCount < objectcount, set lastObjectCount to objectcount

    Else set layer "loader" invisible (and start the level, activate the player character etc)

    Adjust the X seconds to find a value that doesn't trigger incorrectly.

    Like I said, just guessing so could be a load of old rubbish - apologies in advance if that's the case!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's an example using a function. In the example I call the function at the start and on any mouse click (the mouse click also randomises the widths of the sprites to simulate the sprite widths changing during runtime) but you can call it whenever you need to in your project:

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

  • - perfect! Thank you

  • This demo shows how to display total number of points, points per level, hiscore for points per level, and save to local storage - hopefully that covers everything <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

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

  • MPPlantOfficial Good point, cheers. In fact Square would work better than sawtooth, should jump between 0 and 1.

  • Hello!

    Does anyone know if it's possible to set the flash behaviour to continuous rather than stipulating a time? I know I could just give it a crazy big number or create a function using timers/every X seconds, but it would be handy if I could just set it to run indefinitely (setting it to -1 seconds, for example).

  • Hi maxwell88 one way might be:

    Create a global variable e.g. totalWidth

    Put all your sprites in a family e.g. allSprites

    Trigger once:

    System|For each allSprites: System|Add allSprites width to globalwidth

    Set text on text object to globalwidth

  • There's a system condition "If number is NaN" that you can use to check.