R0J0hound's Forum Posts

  • You need to uses double double quotes quotes to put a single double quote in a string.

    It's the equivalent of using \" in other languages.

  • Load it into the array object using the "load" action and then you can access them with the array expressions.

    ex.

    First item:

    Array.At(0)

    2nd:

    Array.At(1)

  • The simple formula for a spring force is F=kx, where k is the strength of the spring and x is the difference of length from a rest length.

    Here is a capx of it in action.

    https://dl.dropboxusercontent.com/u/5426011/examples20/spring_physics.capx

    I also added damping which uses the formula F=-cv, where c is the damping strength and v is the object's velocity along the length of the spring. In the capx the formula looks a bit much because of a vector projection but it works.

  • https://www.dropbox.com/s/cx2qnwz7hhwuk ... .capx?dl=1

    /examples20/rope_loop.capx

    An extension of my previous physics rope example. It now supports multiple ropes and rope loops. Also they are created around sprites placed in the editor for easier setup. A tip for anyone adding joints to newly created objects: you need to wait a tick so box2d updates the object's position and rotation.

  • Wouldn't setting the layer's angle to the player's angle work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Without you're cap I can only guess but is the sprite's "invisible at start" property checked?

  • JohnnySheffield

    Feel free to use/fork/modify this plugin, I don't mind at all. I'd have to look in to setting up a github but it's not high on my priorities list. And cool icon, thanks, I'll be sure to include it in my next update.

  • Look in the plugins section of the forum, there's a plugin there that does that and I think it's actually called "multiline textbox".

  • If you're fine with the projectile stopping when hitting solids you could give the object the platform behavior, disable controls and set acceleration and deceleration to 0. Then you can throw it by setting the vectorx and vectory with events.

    In that case there is a little bit of math but not to much:

    If you know the speed and angle you want to launch the axe do this:

    vectorx = speed*cos(angle)

    vectory = speed*sin(angle)

    Or you could use the bullet behavior and set the gravity property.

    There are capx' around the forum. A search for "projectile" will yield a lot of useful topics.

  • Hi, here's my 2c.

    Since the motion is just along a circle we can calculate the center and radius of that circle and build a nice exact formula to find where the object will be. You do have to account for the case where the rate of turning 0, because motion will be in a straight line and my formula will fail.

    Here's a capx:

    [https://dl.dropboxusercontent.com/u/5426011/examples20/position_perdict.capx

    The last 3 events are the formulas. The rest is just gui nonsense.

  • I used the collideCheck function instead of using the events directly because I just wanted to know if the player is colliding, I don't want to pick the walls. The only reason for that was the nested overlap check in event 12; it needed to check with all the walls not just picked ones. Event 10 moves the player to the position it was at at the start of the frame, then events 11 and 12 move the player again but only a pixel at a time in the same direction. This is to close the gap with the wall. The player's d variable is reduced by the amount moved. This is important so the wall sliding can only go the remaining distance.

  • You could use 5/level if you want level 1 to spawn an enemy every 5 seconds. At level 10 it would be every 0.5 seconds and at 20 it would be every 0.25 second. This works well if you want infinite levels where ultimately an enemy will spawn every frame. You could also tweak the formula further to be

    start_rate/level^factor

    Where factor could be 0.5 for a slower increase of the spawn rate or 2 for a faster increase.

    Another approach you can use if you have a max level is to use lerp. It would look like this:

    lerp(start_rate, end_rate, (level-1)/(num_levels-1))

    So for example if you had 50 levels and you wanted the spawn rate to be 5 seconds on the level 1 and every tick on level 50 your forula would be lerp(5,0,(level-1)/49).

    In general you may be able to use some kind of easing functions to do it too.

    Edit:

    For the second question you could utilize something like this:

    http://www.scirra.com/forum/weighted-probabilities_topic48421.html

  • It allows you to draw a quad using an arbitrary part of a texture.

    This is the definition of the function.

    quadTexUV = function(tlx, tly, trx, try_, brx, bry, blx, bly, tlu, tlv, tru, trv, bru, brv, blu, blv)

    The first two letters of the parameters indicate what corner of the quad it defines. For example tlx is "top-left x", bru is "bottom right u". So for four points you have x,y,u and v. x and y is the point's position on the layout and u,v is the texture position of a texture which are in the range of 0 to 1. Where for u 0 is the left side of the texture and 1 is the right. For v 0 is the top of the texture and 1 is the bottom.

    It's basically like uv editing in 3d modeling programs except there is no z so the example you referenced isn't possible.

    To use it call it in you drawgl function with glw.quadTexUV. To my knowledge there isn't a plugin that uses it yet. quadTex is used however to use a sub-rectangle of a texture. The sprite object uses it when animations are exported to spritesheets. I have also used it in my spritesheet plugin.

  • Here's an updated capx:

    ucdfc0f5aa567d7282514dceca93.dl.dropboxusercontent.com/cd/0/get/CiHMxlTrJzG1FxUwW0OWYbEz3f_jNTiHd7R_aqIR5-lPq4Xesp1W2n5GNsvu8vH7IWwD52h1DijRnk3InNt2uwoXyjpv61A8L2k80bTBXzS0cHuTHyGh0eiUeHmvnoc_WDQ/file

    It will work with arbitrary collision polygons but the wall sliding works best when the edges are in increments of 45 degrees. I found I didn't need that complicated vector math so all the formulas are fairly simple.

  • You can use the "^" symbol, it does the same thing.

    Eg to do Pow(2, 3) in c2 you would write

    2^3