newt's Recent Forum Activity

  • Drag and drop on the preferences would be nice.

  • From the Wiki:

    [quote:11n3qrvm]Lerp(a, b, x)

    Linear interpolation: Calculates a + x(b - a), or linearly interpolates a to b by x%. Eg. lerp(a, b, 0.25) gives the value 25% of the way from a to b

    Basically this is a lot like the game "pick a number between 1 and 10".

    Except for here we are using a percent, so our x, or number we are picking must be expressed as a float. IE 50% would be 0.5, and 25% would be 0.25. In which case our return value would be 5.5, and 7.75.

    In case you were wondering that would be written as lerp(10, 1, 0.5).

    Ok maybe not to terribly useful for that little game, but suppose you had two numbers say something like x coordinates for two different sprites. Then suppose you wanted a third sprite to move somewhere in between the first two sprites, lets say half way.

    With lerp all we have to do to find the point that's in the middle of the two is use the expression like this:

    lerp(sprite1.x, sprite2.x, 0.5)[/code:11n3qrvm]
    Of course you might want to find a y value as well:
    [code:11n3qrvm]lerp(sprite1.y, sprite2.y, 0.5)[/code:11n3qrvm]
    
    Ok in this example half the way was shown with 0.5, so if we wanted to go 1/4 of the way we would use 0.25, and if we wanted to go 75% of the way we would use 0.75 etc.
    
    Now lets put that together. We have 3 sprites, sprite1, sprite 2, and sprite3. Sprite one is on the left side of the layout, and sprite 2 is on the right side. Then sprite 3 you can place [i]anywhere[/i].
    With a simple trigger the event might look something like this:
    [code:11n3qrvm]MouseKeyboard:  On Left Clicked on Sprite3
    

    Sprite3Set position to lerp(Sprite1.X, Sprite2 .X,0.5), lerp(Sprite1.Y, Sprite2.Y,0.5)[/code:11n3qrvm]

    Alright now for the next example lets say we want a smooth transition when sprite 3 moves. We can use lerp for this as well. Note since this would be a continuous action you will need some kind of always event, along with the trigger. I'll use mouse is down.

    MouseKeyboard: Left mouse button is down
    

    Sprite3Set position to lerp(Sprite3.X, lerp(Sprite1.X, Sprite2.X, 0.5),1 - 0.05^TimeDelta), lerp(Sprite3.y, lerp(Sprite.y, Sprite2.y, 0.5),1 - 0.05^TimeDelta)[/code:11n3qrvm]

    Wait... wut?

    To simplify this we have a lerp within a lerp with the first lerp's numbers, or a, and b are our current x,y, and target x,y, then the x could be thought of a step. We use timedelta to make sure there is no frame skip.

    The current x,y is expressed as sprite3.x, and sprite3.y since the sprite is always moving while the mouse is down. Then the target x,y, our second lerp, is written like our original example lerp(Sprite1.X, Sprite2.X, 0.5). Finally the step is expressed as 1 - 0.05^TimeDelta. Basically we are moving a tiny percent of the way each tick.

    More coming soon.

  • I guess I could make a thread and example up.

  • Lerp its your friend.

    MouseKeyboard:  Key "Space" is down
    

    SystemSet Layer 1 zoom ratio to (lerp(200, LayerZoomX("Layer 1"), 0.0005^timedelta), lerp(200, LayerZoomY("Layer 1"),0.0005^timedelta))

    MouseKeyboard: Key "Space" is not down

    SystemSet Layer 1 zoom ratio to (lerp(100, LayerZoomX("Layer 1"), 0.0005^timedelta), lerp(100, LayerZoomY("Layer 1"), 0.0005^timedelta))[/code:3g6pzche]

    Or if your feeling frisky change the second event to an else.

    System:   Else
    

    SystemSet Layer 1 zoom ratio to (lerp(100, LayerZoomX("Layer 1"), 0.0005^timedelta), lerp(100, LayerZoomY("Layer 1"), 0.0005^timedelta))

    [/code:3g6pzche]

  • Hmm yeah this could be a cool plugin for making windoed games with a specialised "window" style, rather than being limited to the standard Windows GUI interface design.

    I would be keen on someone making this... now, where did lucid go?

    ~Sol

    Yeah you could an interface like winamp, etc. As you can imagine, for a game that would make for some awesome eye candy.

  • The line object seems to be missing a few things. I don't seem to be able to find a way to get current z depth, and when placed in a family the "Picked" conditionals are missing from the menu.

    Or is there a reason they are not there?

  • Try Construct 3

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

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

    something like

    bullet: On collision between bullet and Sprite

    Sprite is not overlapping terrain.family

    SpriteMove 10 pixels at (bullet 0 .Angle degrees)

    should work, you might even try offset.

  • 2.0 shader.. no, not really I guess. 2.0 shader that does blur... yeah it might.

  • I would try move at angle.

    bullet: On collision between bullet and Sprite

    SpriteMove 10 pixels at (bullet 0 .Angle degrees)

  • Mouse is down is essentially the same as always. You need to add a condition to that to slow it down.

    Every x milliseconds is probably the quickest way.

    mouse is down

    every 1000 milliseconds

    >do this

  • You could easily use a private variable, and probably a function would do the trick as well.

    But for ease of use I would really like to see what deadeye mentioned implemeted.

  • Is this on xp, vista? Sounds like it might be dep kickin in.

newt's avatar

newt

Member since 12 Nov, 2008

Twitter
newt has 25 followers

Trophy Case

  • 15-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

30/44
How to earn trophies