dop2000's Forum Posts

  • Why so complicated? Remove Drag&Drop from Canvas, enable Drag&Drop on the Sprite.

    Pin each pair Canvas+Sprite together:

    On Start of Layout:

    For each Sprite

    ....Canvas overlapping Sprite: Canvas pin to Sprite

    That's it, you should now be able to drag & drop canvases.

  • You can save all arrays in one text file - one line per array.

    The arrays can be in JSON format or simply a list of values separated by comma or any other symbol.

    Use tokencount and tokenat expressions to parse the file, for example:

    tokenat(AJAX.lastdata, 0, newline) will give you the first line from the file.

    Or you can use CSV plugin:

  • Or pin your image to invisible draggable sprite.

    Or simple change the collision polygon on your sprite - make it smaller.

  • Physics angle of motion:

    angle(0, 0, Sprite.Physics.VelocityX, Sprite.Physics.VelocityY)

    To compare two angles you can use anglediff() expression.

  • Even if you are using lots of sprites, there are still ways to optimize them.

    First, read these tutorials:

    https://www.construct.net/au/blogs/cons ... memory-796

    https://www.scirra.com/manual/134/performance-tips

    https://www.construct.net/au/blogs/ashl ... -works-917

    Try to make images (in sprites) as small as possible. Don't create big sprites and then scale them down on the layout.

    Don't create sprites with many animations.

    If you only need pine trees on this layout, a sprite containing 20 different animations for all kinds of trees will consume a lot of memory.

    If you have huge layouts with thousands of background sprites, try to build a system where sprites are created as you progress through the level and destroyed when they are no longer needed.

    Or at least disable animations/events/behaviors for sprites that are off-screen.

    Avoid using effects and behaviors on too many sprites.

    Regarding the issue with the TargetScale - you can do something like this:

    Every 1 second:
    Tree compare instance variable TargetScale<1   -> Add 0.1 to TargetScale
                                                   -> Tree set scale to TargetScale[/code:vut6cbur]
    
    Trees that have reached scale 1 will no longer be picked by this event.
  • You didn't provide any information - what behaviors you are using? Is this Physics/Platform game? Are these objects Solid?

    If B should not collide with anything, you can simply disable collisions for this object.

    Otherwise you need to handle collisions with events - create events for different combinations:

    A on collision with C -> do this

    B on collision with C -> do that

    etc.

  • Your question is about C2, why are you posting in C3 forum?

    You can generate a big random number, save it to local storage and use it as a unique user ID.

  • You do not have permission to view this post

  • It's hard to tell what your are doing wrong without seeing your project.

    Please share your capx file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why do you need to protect save files like this?

    As a player I would be pissed if I couldn't load my old saves after replacing some hardware on my PC (say, motherboard or HDD).

  • YoHoho

    Of course you can change it for a bigger grid, just need to modify the values throughout the code - for example for 10x10 grid in event #2 change condition to newX<10, in event #4 change the formula to min(9, x+1) etc.

    Did you watch the video from the first comment? This algorithm is used for dungeon generation.

  • If you have three "Open" functions and all three are called at the same time - that's poor project design, not a C2 issue.

    Construct does many things differently from "real" programming languages, but personally I like how flexible functions in C2/C3 are.

  • unixtime can only return current time. So to convert any date/time in the future you need to use some external function or addon.

    Rex's "date" addon can also convert to unix time.

    EDIT:

    Actually, you don't need to use C3 expression and can calculate the remaining number of seconds directly in JS:

    Set difference to: Browser.ExecJS("(new Date('" & textDate & "').getTime() - new Date().getTime()) / 1000")

  • JS code converts date (textDate) into Unix Epoch Time - number of seconds that have elapsed since January 1, 1970

    "/1000" because that JS function returns milliseconds, and we need seconds.

    unixtime is a C3 expression, it returns current system time in unix format, also in milliseconds.

  • Are you using AJAX to request files? Could you post a screenshot of your code?