R0J0hound's Forum Posts

  • 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.

  • 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.

  • It has to do when a newly created object is pickable. You can find details about this with a search about toplevel events.

    This link has info about that:

  • I think after an overlap condition like that you use pick nth instance to pick one or the other. An instance won't overlap itself, you can test this by setting it's opacity to 50 or something to visualize it.

    Another approach I've used is to have a seperate detector object, which you can set to the position of one object and then detect the other ones.

    For comparing angles and such you can pick one instance, save it's iid to a variable then pick all and do the comparison from there.

    Or you can just follow a pattern like this:

    +---------------------------------------------------------------------+
    | for "a" from 0 to sprite.count-1                                    |
    | for "b" from loopindex+1 to sprite.count-1                          |
    | compare sprite(loopindex("a")).angle = sprite(loopindex("b")).angle |
    +---------------------------------------------------------------------+
       +------------------------------------------------------------------+
       | pick sprite instance loopindex("a")                              |
       +------------------------------------------------------------------+
       +------------------------------------------------------------------+
       | pick sprite instance loopindex("b")                              |
       +------------------------------------------------------------------+[/code:x9i4nh5x]Or some simplification to that effect.
    
    There are other ways too, and basically it involves picking one, and saving values to variables then picking the other.
  • The simplest way would be to use the physics behavior and just move the player instead of the terrain. Or you could use the chipmunk physics plugin instead since it works fine if you move an object. The normal physics behavior throws the object when you move it which is why you can't use it to begin with I guess?

  • bloodshot

    You can search my posts and I have made several different examples of doing physics with events. None are comprehensive, instead they focus on doing certain things.

    In the example you're giving it's probably easier to use the physics behavior instead somehow. Unless you have a convincing reason not to.

    But hey, if you really want to you can do it yourself and the rules above would work somewhat. It becomes a little more involved since the football rotates. As part of resolving the collision you'll want the point and normal of collision (you can have multiple points with complex terrain). The next but gets slightly more involved. Basically you apply an impulse at that point onto the ball which will result in linear and rotational motion. You'll also want to consider motion perpendicular to the contact normal and apply a friction impulse. There's guides elsewhere online that have the formulas you'll need.

  • How would you do it if you did it on paper? Can you write out the steps you would take and what rules you want?

    Do that and you're most of the way there, and we can give suggestions about what features and events could be used to do each step.

  • Basically any trigger except "on collision" (which is run in place) can be run inspite of its location on the event sheet. Simple things like "on start of layout" and "on function" are example where you wouldn't want it to run when the event sheet gets to them. Another reason is if the condition is triggered multiple times. With mouse button is down that event would run only once per frame, wereas on click would run for every click. Now for the mouse this won't really happen since you can't click multiple times in 1/60th of a second. It is possible with something like on any key pressed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the general case you can set it up like this:

    Global number t=0
    Global number tt=0
    
    Every tick
    --- set t to (t+dt)%2
    
    t<1
    --- set tt to cubic(0,0.5,0.5,1,t)
    
    t>=1
    --- set tt to cubic(1,0.5,0.5,0,t-1)
    
    Every tick
    --- set X to lerp(A, B, tt)[/code:1i6tummh]
    t goes from 0 to 2 every two seconds. You can adjust it so it goes at a different speed, or just make it stop at the end. 
    
    tt maps t to a curve. There are actually two curve parts. Going toward the target and coming back. The cubic expressions is where you define the shape. Change only the two 0.5 parameters. So for example an ease in/out could look like this:
    Set tt to cubic(0, 0, 1, 1, t)
  • It's just a behavior. It's not affected by that setting.