dop2000's Forum Posts

  • This is easy to test:

    On my PC picking the sprite 10 million times by IID is the fastest - takes 8 seconds, by UID takes 10 seconds, and by instance variable takes 13 seconds.

  • legofreak689 Please post your capx.

  • I don't have issues with tilemaps and all my ( ) are in the right places :)

    You mean you want to set tile by number? For example, "Set tile #57"?

  • I read your comment several times... Either I don't understand your issue, or you don't understand how tilemap works.

    If you have 10x10 tilemap and you want to set tile at row number 1, column number 4 (they are zero-based), you do Set tile (4, 1)

    If you need to set tile at mouse coordinates: Set tile (Tilemap.PositionToTileX(Mouse.X), Tilemap.PositionToTileY(Mouse.Y))

    There are a few other expressions to convert from screen coordinates to tilemap index and back in the official manual.

  • Why don't you test it yourself?

    .

    Also, if you have nested loops and you need to refer specific index, use loopindex(name), for example loopindex("RoomX")

  • 1. I believe you can style Text Box using CSS - change background and everything. But personally I don't like using form controls, it's better to make your own version of TexBox, here is the tutorial.

    2. What's wrong with "Set tile" action?

    5. C3 can open C2 projects, but if you used any C2 addons, then need to be installed in C3 as well.

  • Why do you need the array? Why not set animation simply to "ID_Card"&card_num ?

    I'm always telling people that many things that usually require arrays, in Construct can be done easier without them. I'm pretty sure you don't need any arrays here. You can generate all cards in advance, or simply put them on the layout in editor and set their animation names. See these examples:

    dropbox.com/s/b7qmdni2wn9zedn/CardHand.capx

    dropbox.com/s/mz2fdnt7g3levqp/CardHand2Players.capx

    Dealing the whole deck of cards without any arrays!

    Edit: oops, forgot to mention, you will need MoveTo behavior to open these files. It's a great addon, I highly recommend installing it.

  • This is a bit tricky..

    You can generate the size of the next sprite in advance. Say, you're spawning sprite #1 (small), and at the same moment you randomly choose the size of sprite #2 (which will be created next) and save it in some variable.

    Let's say sprite #2 will also be small. Since you know that current sprite and next sprite are both small, you can use Timer behavior to schedule next spawn event in 1 second. If next sprites is big, you increase the delay and spawn it in 2 seconds. If both current and next sprites are big - in 3 seconds. This way the distance between sprites of different size will be roughly the same.

    This was just off the top of my head, there may be other solutions.

  • The point of fetching the cpu util during each loop was to get the highest main thread across the entire loop run, without waiting for the above condition to finish.

    And I'm telling you, this is wrong :)

    cpuutilization in that loop returns exactly the same value a million times. And that value is useless, because it shows what cpu utilization was before the loop started (when the app was idle).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • have you tried googling?? Took me 5 seconds to find.

    construct.net/forum/extending-construct-2/effects-31/effect-2-5d-platformer-109594

  • It's done using shadows. See this post for a collection of different 3D effects you can do in Construct:

    construct.net/forum/construct-2/how-do-i-18/how-do-i-make-3d-game-in-const-117027

  • Depends on the behavior you are using.

    With Platform, if you need to push the player back, you should do something like this:

    Player is mirrored -> Player Platform set VectorX to (Player.VectorX+1000)
    Else -> Player Platform set VectorX to (Player.VectorX-1000)
    

    Similar with 8-Direction - add some value to Vector X or Vector Y (or both), depending on the angle of pushing.

  • So a is the ammo in your magazine, b the "ammo in your pocket"

    Create a local variable reloadAmmo, then do this:

    Set reloadAmmo to min(12-a, b)
    Subtract reloadAmmo from b
    Add reloadAmmo to a
    
  • Just set the correct angle before pinning. You can try "Set angle towards GreenSprite" and then "Rotate 90 degrees counterclockwise".

    Or "Set angle to (angle(Self.x, Self.y, GreenSprite.x, GreenSprite.y)-90)"

  • Here is the 1000.000 loop example , you will also say that the 20% -80% difference in cpu usage

    You are doing it wrong.. There is no point in checking cpuutilization one million times inside of the loop, because the loop is done in one tick (however long). And cpuutilization will return the CPU load for the previous second, that was before the loop.

    Here is the more correct way (both events run on every tick):

    I'm getting maybe 2-5% lower CPU utilization with choose(). Yes, it's a bit more efficient, but only if you need to use it hundreds of thousands times every second. Definitely not worth worrying about if you need to spawn just one explosion.