R0J0hound's Forum Posts

  • But what you replied with is math too, and actually it's basically the the same as what I referenced.

    Velocity is a vector. Or basically it has a x and y value. The magnitude of a vector is it's length which can be calculated with the Pythagorean theorem:

    sqrt(sprite.physics.velocityX^2 + sprite.physics.velocityY^2)

    Or just use the distance expression, which does the same thing:

    distance(0, 0, sprite.physics.velocityX, sprite.physics.velocityY)

    In your example the "sqr" means the value is squared so that would be this:

    sprite.physics.velocityX^2 + sprite.physics.velocityY^2

    or this

    distance(0, 0, sprite.physics.velocityX, sprite.physics.velocityY)^2

    just repace "obj.velocity.sqrmagnitude" with one of those.

  • I guess it could happen if it doesn't close correctly. So after closing them all, if you re-open your game and close it are there any still running?

    If stuff is being left behind after one run then that's bad and good. The bad is self evident. The good is it's repeatable, so it should be quicker for nw.js to fix I suppose.

  • The last code block above should work for that by changing the center variables.

    If you like you can poke around my capx I made to try it out. I got a little carried away but it might give some ideas.

    https://dl.dropboxusercontent.com/u/542 ... ation.capx

  • Chrome and in turn nw.js like to run in multiple instances like that. If the instances are still running after closing you game then that's a problem, but if they all close too I guess it is normal.

  • Maybe try this behavior:

    The normal car behavior doesn't play well with physics

  • In the exported folder there is a debug.log file. Does it have any errors?

  • It isn't really reasonable to want an answer within a half hour. Your question isn't clear, do you mean you want to get the speed of an object? You can calculate it with the Pythagorean theorem and the x and y velocities. Maybe this topic may help:

  • Ok, here's a python version.

    https://www.dropbox.com/s/73o1wa4ts21uf ... y.cap?dl=1

    /examples31/saveLoadpy.cap

    The first script under the "start of layout" is the meat of it. It has two functions to save/load to a json file.

    The first function is save. As an example it can be used like this:

    save("myfile.txt", Sprite, Sprite2, Family3, tiledBackground)

    Basically the first parameter is the filename and you add the object types you want to save as the following parameters. You can use as many types as you need. Sprites, tiledbackgrounds and families of either should work.

    Load is simpler, you just use a filename as a parameter. For example:

    load("myfile.txt")

    Other nice to knows:

    The file is saved in the working directory i think but if you want it to be saved to the apppath use:

    System.AppPath+"myfile.txt"

    If you want to only save the picked objects use SOL.Sprite instead of Sprite.

    Saving tiledbackground's instance variables will crash so it's not done.

    Finally there isn't a way to find out what an object's collision mode is in events so it can't be done in python.

  • You can access the picked objects using the SOL object.

    So say the object name is "sprite", then in Python you would loop over the picked sprites with:

    for obj in SOL.sprite:

    obj.x=2

    There are some older posts with more details about Python that may also help. Anything accessible with events is accessible from Python, well except many conditions such as triggers can't be used in Python but that's about it.

    Give me a day or so and I'll wip up an example.

  • Both are the same. To be able to draw the image it has to be in memory.

  • You mean will it make your game run faster? The most it would do is make the game download quicker if the file size is smaller. The speed of uncompressing might change but it doesn't matter since it's only done once and is not a bottleneck at all.

  • you could use a global variable and a loop. something like:

    every tick

    --- set global 'anykeydown' to 0

    for "" from 0 to 255

    key loopindex is down?

    --- set global 'anykeydown' to 1

    global 'anykeydown' equal to 0

    --- do stuff

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    I know this doesn't answer your question directly but I've found it's tricky to get that working good with collisions.

    One idea i've tried before that works well is to instead just keep track of how far each block should move.

    https://dl.dropboxusercontent.com/u/542 ... _drop.capx

  • If you want to create them every tick, you'll probably wan to destroy them all every tick first. You can also change the loops to go from -2 to 2 instead.

  • No problem. It was fun to make.