R0J0hound's Recent Forum Activity

  • It allows you to draw a quad using an arbitrary part of a texture.

    This is the definition of the function.

    quadTexUV = function(tlx, tly, trx, try_, brx, bry, blx, bly, tlu, tlv, tru, trv, bru, brv, blu, blv)

    The first two letters of the parameters indicate what corner of the quad it defines. For example tlx is "top-left x", bru is "bottom right u". So for four points you have x,y,u and v. x and y is the point's position on the layout and u,v is the texture position of a texture which are in the range of 0 to 1. Where for u 0 is the left side of the texture and 1 is the right. For v 0 is the top of the texture and 1 is the bottom.

    It's basically like uv editing in 3d modeling programs except there is no z so the example you referenced isn't possible.

    To use it call it in you drawgl function with glw.quadTexUV. To my knowledge there isn't a plugin that uses it yet. quadTex is used however to use a sub-rectangle of a texture. The sprite object uses it when animations are exported to spritesheets. I have also used it in my spritesheet plugin.

  • Here's an updated capx:

    ucdfc0f5aa567d7282514dceca93.dl.dropboxusercontent.com/cd/0/get/CiHMxlTrJzG1FxUwW0OWYbEz3f_jNTiHd7R_aqIR5-lPq4Xesp1W2n5GNsvu8vH7IWwD52h1DijRnk3InNt2uwoXyjpv61A8L2k80bTBXzS0cHuTHyGh0eiUeHmvnoc_WDQ/file

    It will work with arbitrary collision polygons but the wall sliding works best when the edges are in increments of 45 degrees. I found I didn't need that complicated vector math so all the formulas are fairly simple.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use the "^" symbol, it does the same thing.

    Eg to do Pow(2, 3) in c2 you would write

    2^3

  • If deltatime is holding you back then ignore it and do your motion without it and deltatime can be added later.

    Anyway 8direction is simple enough to make with events. The main thing that's tricky is collision response or with those videos wall sliding. Here is a capx with the preliminaries of collision response.

    uc70c03cdc2228071223662b418d.dl.dropboxusercontent.com/cd/0/get/CiHHa_hEKm0xT5aQ5p6-C-8sWP7nL9vg6euHMtqtHbDQgW86StTMIaCUPa8VFrIo6bMu9cteovWnWEbw7FmTZqamyQm_jSiRTxyPkl3CTybnBgSXhKWyyS5c6tSoDpq3XB0/file

    It's incomplete as I ran out of time today. If you remove event 14 then it should basically work like the behavior. On a side note you can get motion with the behavior without acceleration or deceleration by setting them very high.

    Anyway since you can't access the collision polygon from events you'll have to either make assumptions about the wall shape or devise a way to find approximately where the collision occurred and the angle of the side hit. One documented method floating around the internet is the separating axis theorem (or SAT). The only drawback is it's a bit lengthy and tedious to make with just events, although as a plugin it could be useful.

    I'll try to finish the example up over the next few days.

  • R0J0hound - Couldnt you also just calculate the z order by placing a image point in the upper left corner of the box and sort using that?

    For each Family1 ordered by Family1.ImagePointY(1) ascendeing

    --- Family1 move to top

    Test it and see. The bottom right box doesn't get sorted correctly right off the bat.

  • The cap file format hasn't changed since 0.99.96, so anything newer than that will work.

  • Hi,

    This will be a dump of various tests and examples that I haven't posted elsewhere. Enjoy.

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

    A test to keep multiple moving sprites from overlapping each other or overlapping the walls. The wall collision resolution is done with the seperating axis theorem (SAT) which has the benefit of allowing the sprites to smoothly slide accross the walls. The motion is done with verlet intergration which when used with a way to push out of obsticles provides for decent boncing.

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

    A non-interactive 2d skier simulation. The slope is a randomly generated continuous curve of beizers. The skier has some manually evented physics so he smoothly goes down the slope and gets air on some hills. As a side note the only behaviour used is "scroll to".

  • Instead of using "sprites is overlapping sprites" create another family of the same objects, then you can use "sprites is overlapping sprites2" and you can clearly pick one or the other.

  • Erasing is done by pasting an object with the "destination out" blend. To erase an abitrary shape you'll have to draw to another canvas give it the "destination" out blend and paste that to the original canvas.

    stachir

    My Paster plugin allows you to draw a texture to an arbitrary quad, but it currently uses the whole texture instead of a sub-texture. But it appears doable with that.

    TwinTails

    With this plugin you can draw whatever you want, so you have the visual aspect. The collisions isn't aren't really possible with this as it's collision polygon is always just a rotated rectangle so it's not good for collisions. There are capx' around that show ways to do per pixel collisions but it's you'll need to put actual sprites over it so it can be somewhat tricky. You could try yann's Polygon plugin as it handles the drawing and collision polygons.

  • You're welcome. On further thought "this" is the only thing that's not minified so it should work with a minified export. You only run into trouble if you try accessing thing that will be minified such as "this.runtime".

  • Ok. In the past I've seen the bug where adding another object removes another and I was able to make a utility to fix it although I'm not sure of the original cause. My hunch is it may be related to copy/pasting between caps in some situations.

    Anyway here's the utility I made to fix the issue:

    http://www.scirra.com/forum/utility-python-cap-reader_topic42039_post260632.html#260632

    On the technical side the cap file keeps track of what id will be used next for object types, object instances, effects, behaviors, and family effects and behaviors. The issue arises when this value is the same as an existing id so when something new is added two things will have the same id and undefined things happen. All the utility does is check all things that have an id and find the highest value, adds one to that and writes it back to a copy of the cap.

  • For that type of isometric you can still use "for each ordered" depending on what features you want to have. Using for each gives absolute sorting whereas comparing one object to another is relative sorting, which can prove to be more complicated.

    Here is an example with the simplification of everything being on a ground level. I put the hotspot on the bottom-right-front corner of the box. You should have consistency for where the hotspot is placed otherwise it can become very complicated indeed. Next do some measurements on your box, particularly just measure the top face of the box. I measured it as 308x108. Put the player and box in a family and now we can make the "for each ordered expression".

    For that I used the formula of a line:

    y-y0 = m *(x-x0)

    The idea I came up with is from that formula is as follows.

    <img src="https://dl.dropboxusercontent.com/u/5426011/examples20/iso_idea.png" border="0">

    Looking at a screenshot I drew a bold red line on each box from the bottom-left-back corner to the bottom-right-front corner. Notice they are all parallel. Next I extended lines to the left and I also made a line from the player using the same slope as the other lines. The y order of where the lines hit the left is the same order they can be sorted. So all that's left is to calculate where the lines will hit.

    First we rework the formula to solve for y0 when x0 is 0. This is where the line meets the left.

    y0=y-m*x

    Then we can calculate m (or the slope) from the measurements. The definition of slope is rise/run or (change in y)/(change in x).

    So...

    m=108/308

    and our formula is now:

    y0=y-(108/308)*x

    Finally make an event as follows:

    For each Family1 ordered by Family1.Y-(108/308)*Family1.x ascendeing

    --- Family1 move to top

    Example capx:

    https://dl.dropboxusercontent.com/u/5426011/examples20/iso_test.capx

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound