R0J0hound's Recent Forum Activity

  • You can still use that method with the built in physics.

    I'm saying if you used chipmunk physics instead there's an expression to get the point of collision under a "on post collide" condition.

  • That particular formula doesn't use perlin noise, it's just a sine wave.

    Most of the values are pretty arbitrary, but the general form of the equation is:

    https://www.google.com/webhp?sourceid=c ... 0of%20sine

    y = amplitude * sin(frequency*x + phase)

    amplitude is how high the waves go.

    frequency is how close the peaks are.

    phase is the initial x offset.

    In the formula as I wrote it in the capx.

    rnd1, rnd2, rnd3... are just some random numbers I saved. And the Array.curX/40 basically scales it to the array which is 40x30. The other numbers just tweak it a bit.

    I used grater than because i wanted to fill in everything below that graph.

    As far as an example here's how I would do infinite terrain with perlin noise.

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

    It matches the "perlin noise with vertical gradient" in that previous capx.

    The scrolling is done by covering the screen with the blocks, and disabling/making invisible the blocks that should be clear. Then as the blocks go off the left of the screen they're moved to the right and updated.

    The shape of the terrain is defined in the update function. Just by fiddling with the numbers you can get a wide variety of terrain shapes.

  • If you use the chipmunk behavior it can give you this info.

    If one of the objects is a circle you could also do this:

    viewtopic.php?f=147&t=153479&p=967445&hilit=collision#p967445

    Another idea that would work ok in most cases is add an image point to every corner of the object's shape. Then loop over the image points and see if they overlap the other object. For every one that does get an average position and that will be your point of collision.

    https://www.dropbox.com/s/ndzxmp4mwc5sd ... .capx?dl=0

  • You could possibly create an effect to draw a circle. I didn't find one with a quick search though. Another idea is to use the third party canvas plugin to draw the circle.

    For using a sprite I'd just go with a size that looks good to you.

  • With that plugin you set a seed then use the perlin2d(X,y) to get a value from -1 to 1 for any position. So yes, it's like a cloud.

    For terrain the usual method is to use a threshold on the result. Like if the value is greater than 0 make a tile, else leave that spot empty.

    The only gotcha of the plugin is if x or y are integers (no decimal part) the result of the perlin expression is 0 so you usually should multiply X and y by some decimal number before using it as a parameter. Also you'll be doing that anyway to scale the noise to your preference.

    That said, it's just and idea and may not work well enough in some cases.

    Edit:

    Here's an example of getting 2d terrain with that plugin.

  • I'd recommend using the noise plugin:

    It lets you use perlin noise which is the basis of Minecraft's terrain generation.

  • It depends on what you want to do.

    Anything inside " " is just text.

    Ex: "Sprite"

    That is is just an expression for text with a value of Sprite.

    Parenthesis () have two purposes. The first is just like in math to control what operations are done first.

    Ex: 1+2*3 = 7

    Ex: (1+2)*3 = 9

    The second purpose is for expressions that take parameters.

    Ex: sin(45)

    Ex: min(1, 3, 2)

    Beyond that it should be pretty simple. But feel free to post the equation you made that doesn't work and describe what you want it to do.

  • Those two actions are run before everything is rendered. The spazzing is probably turning to abruptly.

    Making the turning smoother can help. Instead of rotating by 45 rotate by a smaller value. And instead of setting the angle away from the player, use the the rotate towards action with a negative value.

    The last issue you mentioned about it spazzing against walls will require another method than what I posted. I just handled single trees where it chose left or right of the tree depending on what was closer.

    I only have a rough idea how walls could be handled. However I don't have any easy solutions at hand.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 4ror

    You can do it in the editor. Just setup the patterns off the layout and use a second object as the center. Group them together with a variable, then just read it into an array at the start of the layout and delete the objects.

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

  • I'm unfamiliar with that course, but the way I'd do snapping is to make your puzzle with all the pieces in place in the editor. Then add two instance variables to the pieces: "startx" and "starty". They are the locations you'd want to snap to. You don't set them in the editor, instead do it with an event:

    start of layout:

    --- sprite: set startx to self.x

    --- sprite: set starty to self.y

    Then snapping can be done by comparing the distance between the sprite and startx/y when you drop it.

    sprite: dragdrop: on drop

    system compare distance(sprite.x, sprite.y, sprite.start.x, sprite.starty) < 16

    --- sprite: set position to (self.startx, self.starty)

  • I don't quite follow the issue you're having.

    When I tried out my idea it came out different than my post above after I tweaked it for a bit. Here it is:

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

    It's still not perfect as the deer can run through the trees, especially when being chased.

    The perfect solution would utilize this I guess:

    http://gamedevelopment.tutsplus.com/ser ... edev-12732

    http://www.red3d.com/cwr/steer/gdc99/