R0J0hound's Forum Posts

  • The example is the physics. The particles move down and shift left and right to settle in heaps instead of tall pixel piles. That is roughly what the particles example you referenced does, except it has more spread.

    Did you have a different kind of physics in mind?

  • Here's the example with two required shaders. It also requires the paster plugin.

    https://dl.dropboxusercontent.com/u/542 ... shader.zip

    black is empty

    white is wall

    everything else is a particle.

    There are probably other ways to improve it, but since it's using webgl I get very low fps.

  • I can't attempt to make an example for a day or so.

    You won't need the canvas plugin, you'll need the "paster" plugin. It's much like the canvas plugin but it can utilize webgl. Notice web browsers used to let my machine use webgl.

    Other than that the rest is just a rough outline.

  • Here's one way:

    Basically you find the distance() and angle() between both objects, then if the distance is greater than the radius you can the set the second object's position to the first and use the "move at angle" action with the angle and radius as parameters. Or some variation of that.

    Here's one possible example in case the above capx doesn't do it as I recall.

    Global number dist=0

    Every tick

    --- set dist to distance(sprite1.x,sprite1.y,sprite2.x,sprite2.y)

    Dist>radius

    --- sprite2: move dist-radius pixels at 180+angle(sprite1.x,sprite1.y,sprite2.x,sprite2.y) degrees

  • Your images aren't working

  • To use a shader to do it you'll need two things:

    1. A effect to do it

    2. To store the result of the effect into a texture so it can be used for the next frame.

    I'll start with 2 since that's somewhat simpler. You'll need the paster object to do this. Ideally you could have the effect on the paster object and paste it to itself every frame, but you can't paste an object onto itself. So instead you'll need two pasters with the effect and you'll need to alternate the object you're pasting from and pasting to.

    So basically the first time do this:

    Paster1: disable effect

    Paster2: enable effect

    Paster1: paste paster2

    Second time do this:

    Paster1: enable effect

    Paster2: disable effect

    Paster2: paste paster1

    And repeat from the start.

    As far as the effect there isn't really a good reference. My thought is you could do it with two effects.

    One to move the sand down. It's logic would look like this:

    If pixel=white and pixel below is black

    Then set result to black

    If pixel=black and pixel below is white

    Then set result to white

    Then the second would shift even or odd scanlines left or right.

    So the effects run for one frame could be:

    Down

    Odd left

    Down

    Odd right

    This really cries for a test, but webgl doesn't work on my computer.

  • You can do it by saving the player's positions to an array and setting the ghost's position from that.

    Example here:

  • The terrain was probably done with an array of the y position of the terrain at every X, or maybe just a polyline. It's fast because only the points near the bike need to be checked. That is an optimization that works in that particular case. C2 is more general purpose, but the same idea could be used with manual collision detection and response.

    The recommended C2 way is to make the terrain up of multiple objects that make up the curve. Tilemaps could be used but they may not give smooth enough curves depending on what you want.

    More ideas here:

  • Another one?

    It doesn't look trivial to wrap into C2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To best show what static does make an event like this:

    +-------------------------+
    | every tick              |
    +-------------------------+
       local number a=0
       local static number b=0
       +----------------------+
       | every tick           | add 1 to a
       |                      | add 1 to b
       |                      | set text to a&" "&b
       +----------------------+[/code:3p392zri]
    
    notice that you'll get the text set to two numbers "1" and an increasing number.  Basically static makes the local save it's value.
  • You just drag the variable around to change if it's local or global. Global variables are all the way to the left and local are nested under something else.

    Constant, like you say can't change.

    Static makes the variable like a global in that it keeps it's value and isn't reset every time like locals are.

  • Here's an example with the family idea:

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

  • There are other topics about this. The simplest is to use a family where the family contains "Sprite". Then you can do:

    Sprite is overlapping family

    That way each are picked in their own type.

  • You could use an equation like this to get the value to go from 0 to 180 and back to 0 based on time.

    value = abs((time*speed+180)%360-180)

    If you set speed to 180 it will take a second to go to 180 and another second to go back to 0.

  • Here's the example you were thinking of:

    It's not set up to handle tilemaps.

    Also if you search my posts about "collision normal" you can find some ways to find the angle of the surface an object is colliding with.