R0J0hound's Recent Forum Activity

  • Ok, here's the general purpose case with any ellipse bouncing on the floor with friction.

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

    Any other shape can work too, it just requires mass, inertia, and contact point calculations.

  • You can control the speed by changing the vx,vy, and w variables directly, but I guess that's enough about that.

    That formula only works for balls, and even that last link you posted will only work for balls.

    You could go for something more general purpose like this:

    r0j0-s-experiments_p955579?#p955579

    And the tutorial it was based on:

    http://allenchou.net/game-physics-series/

    You could also read here for info on how the box2d or chipmunk libraries work and use that.

    http://myselph.de/gamePhysics/index.html

    There's also this classic reference, but I guess it doesn't take into account friction:

    http://chrishecker.com/Rigid_body_dynamics

    In summery you either need to follow one of those, derive your own, or use a preexisting solution such as box2d or chipmunk. The first two will require you to ramp up your math skills.

    Edit:

    this link is also helpful:

    http://www.myphysicslab.com/collision.html

    edit2:

    It seems to have the math derived here:

    https://en.wikipedia.org/wiki/Collision_response

  • There are many different ways. Here's one:

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

    It's divided into multiple passes over the grid

    The first pass creates a hill using basically a sine wave,

    Then in that hill it creates a rock layer using a sine wave, a parabola, and some random noise with a falloff with y.

    It also speckles some gold below a certain depth with some random noise with low probability.

    The second pass digs out caves using bilinear interpolation over a smaller array of random values.

    The third pass removes single tile wide edges, and changes dirt to grass if on top, and gives it a chance to grown down further.

    This doesn't even scratch the surface of things you can do, and you can even get entirely different terrains by just tweaking numbers.

  • It doesn't work because the article you used made typos when writing the equations. Look at the paper it references for the correct formula. Also there's no need to use the custom movement behavior, it adds nothing but making the equations longer.

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

  • I don't understand. If one can be made, just add another.

  • Maybe -1?

  • It isn't the 6th sprite picked, it's the 6th sprite regardless.

  • The basic gist of terrain in terraria is something like perlin noise is used to generate the terrain. The third party noise plugin can be used to do perlin noise. You can also generate the terrain in many different ways. Here's a link with some of them:

    You can also search for terraria or generating terrain or things like that with the forum search and get some more info here and there.

    That should give the basics for generating terrain. Anything more complex is just a creative mixing of them to give something pleasing. It's basically a lot of tweaking.

    For example the mountains and hills could be a 1d perlin noise curve, and the caves could be some 2d perlin noise overlaid on that. Different materials could be done with some more 2d perlin noise as well. Trees and grass just would be on dirt with air above it. RookieDev made a recent question on how to detect that. Otherwise that's just a rough start.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can do that in five events. The first does the motion, and the other four are for bouncing off each wall.

    global number radius=16

    global number gravity=1000

    global number elasticity=0.5

    every tick

    --- add gravity*dt to vy

    --- set x to self.x+vx*dt

    --- set y to self.y+vy*dt

    y>640-radius

    --- set y to 640-radius

    --- set vy to -elasticity*abs(vy)

    y<radius

    --- set y to radius

    --- set vy to elasticity*abs(vy)

    x>480-radius

    --- set x to 480-radius

    --- set vx to -elasticity*abs(vx)

    x<radius

    --- set x to radius

    --- set vx to elasticity*abs(vx)

  • In what I posted above, 0 is empty and 1 is dirt. It doesn't matter what values you use, 0 can be dirt but you need a value for empty. How do you currently know a position has air?

  • You could. It just identifies all the places where air is above dirt. You can then do what you like in the actions.

  • Just loop over the array and if the current value is dirt, the value above is empty do whatever.

    The actual event to do this is like this here:

    For each xy

    Array at (curx, cury) = 1

    Array at (curx, cury-1) = 0

    --- do something

    At least that's the simple case of air to dirt.