R0J0hound's Forum Posts

  • As a note you get the speed from velocityX and velocityY with this calculation:

    speed = distance(0,0,velocityX,velocityY)

    or

    speed = sqrt(velocityX^2 + velocityY^2)

    which is the same, just whatever you prefer.

  • Another idea could be to use the function object.

    global number cur = -1

    On function "next"

    --- set cur to (cur+1)%Function.ParamCount

    --- set return value to Function.Param(cur)

    On any click

    --- Set text to Function.call("next", "apples","oranges","bananas")

  • cool

  • This works

    (time<5 | time>10)?"not now":"now"[/code:gn5necf3]
  • I'd have to see a capx as I don't know from your description.

  • Yes hard. You could use the multiplayer chat example as a base, or use the peerjs third party plugin. Both have the side effect of needing access to the internet to at least get going.

    Or maybe very easy. You could use the clipboard as the way to send messages. Just set the clipboard in one app and periodically check in the other app. Although it could be annoying to the user with the clipboard contents being changed. You could also do it be reading and writing to a certain file.

  • [quote:3s96hura]Also, is there going to be rotation?

    It already has rotation. Objects rotate on collision and there are actions to set angular velocity and torque. Unless you mean something else?

  • Joannesalfa

    For that one remove the "mark neighbors" call in event 5 and add another event right below:

    tile y=32:

    ---- tile set marked to true

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I apologize I looked at it again and I misspoke, it should have been event 12.

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

  • SgtConti

    Can you provide more details or a capx where it occurs? I don't get an error when using two sprites. Although tiledBg does seem to have an issue when the hotspot is top-left.

    I've been on a break from coding for a bit, but I should be resuming soon.

  • In the example i did before its just another floodfill. It's started by picking the top row gems, then a flood fill is done and anything that's not picked is not connected.

  • Agreed it's better using the physics because it does a lot for you, but it never hurts to lean something new.

    The formula that correlates velocity to angular velocity is:

    displacement x velocity = angular_velocity

    Where "displacement" is a vector from the pivot to the point of collision and "x" is a vector cross product. "w" will be in radians/sec so we'll need to convert it to degrees/sec by multiplying by 180/pi.

    (displacement x velocity)*180/pi = angular_velocity

    So to finish it up the displacement vector can be calculated with:

    dispX = collisionX - pivotX

    dispY = collisionY - pivotY

    Also a 2d vector cross product can be defined as:

    v1 x v2 = v1x*v2y - v1y*v2x

    So them combining those you get a lovely formula like this:

    ((collisionX - pivotX)*vy - (collisionY - pivotY)*vx)*180/pi = angular_velocity

    "vx" and "vy" are the x and y components of velocity. Depending on the behavior used you can also get vx and vy from speed and angle_of_motion:

    vx = speed * cos(angle_of_motion)

    vy = speed * sin(angle_of_motion)

    So to use the formula you could make a collision event when a bullet collides with sprite, and use the bullet's position for collisionX and collisionY.

    Now all we have is a way to convert linear motion to angular but it's not enough for it to look realistic. For that you'll need to use momentum and kinetic energy to calculate a collision response. There's info on it elsewhere but the formulas get kind of lengthy and really it's one of the main reasons it's much easier to use an existing physics engine.

  • Joannesalfa

    You need to reset "picked" and "visited" to false every time before doing the floodfill. Doing it in event 13 works.

  • I have it check if the bounding quads overlap since there's no need to paste if the object won't show. I assumed that disabling collisions wouldn't affect it. Since that doesn't seem to be the case then it will have to wait till I have time to find a fix.

    Cheers

  • Hi,

    Late reply but the main difference between this and the tiledbg is tiledbg repeats the texture and this plug does not. It works with a single drawimage call with a sub rectangle, nothing fancy.