R0J0hound's Forum Posts

  • Well I only program as a hobby so my fingers don't have a chance to go lame unless I break them at work. :-/

    Here's the capx:

    https://dl.dropboxusercontent.com/u/5426011/examples21/paster_3d_6.capx

    To get the events in your project open this capx and your capx in different tabs of the same instance of Construct. Then you can copy/paste the objects to your capx. The object to copy over are 3dbox, face, p, Paster and Function. After that you can copy over the events.

  • I found a program a while ago that can print the contents of a scrolling window. It works well for events.

    http://www.scirra.com/forum/printing-out-events-on-paper_topic83258_post485840.html#485840

  • Beaverlicious

    I tinkered a bit with the example and got the perspective correct so the base matches the sprites. So if you're currently making the game just leave sprites for the bases of the buildings and the 3d can be added later once it's working. Once working the 3d will be on a seperate layer above the game layer and below the HUD layer. It will take a bit more tweaking to get to that point and I'll upload it when it's done. Be advised though that the polygon sorting isn't correct at times esp when boxes are near each other which is kind of distracting. I'm pretty sure it can be fixed if I sort the polys with a topographical sort which is in my todo to add to the capx.

    No eta, but my weekend starts soon so I should have some time to work on it.

    Cheers

  • Wouldn't doing a system compare of the LayoutName expression work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, the functions aren't exposed. The workaround is to call a function in the event sheet and set the parameters there.

  • Everyname

    Thanks for the fix.

    Beaverlicious

    Those recommending Paster for 3d probably were referring to this capx:

    http://www.scirra.com/forum/suggestion-simple-3d-objects_topic82718_post483742.html#483742

    Paster provides little to provide 3d other than an action to draw a distorted texture. The rest is math and logic.

    The capx isn't simple but it could be tweaked and extended to make the game you have in mind, but as it is now it's incomplete.

  • I use a free account of dropbox for all my capx uploads and have no problems with it.

  • The problem can be thought of how to find out if a point is inside a polygon.

    Here is capx with one solution:

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

    Edit:

    You can eliminate the need for variables if you add a imagepoint to the right-center of the line object and do this:

    For each Sprite
    For each line
        | compare: line.y>sprite.y != line.ImagePointY(1)>sprite.y
        | sprite: x < (line.ImagePointX(1)-line.x) * (sprite.y-line.y) / (line.ImagePointY(1)-line.y) + line.x
        -----
            + Sprite: set animation frame to 1-Sprite.AnimationFrame[/code:wl2fbtnb]
  • After fiddling with it a bit I don't find the custom behavior's push actions useful at all so I tried a few other methods. One that came to mind is to use the 8direction behavior instead and use events to set the horizontal and vertical velocities. It didn't work ideally since the 8direction often stops short of the walls if going too fast.

    If you're fine using boxes with no rotation for the walls for now here is a capx. It uses a simplified case of the Separating Axis Theorem to do the push out and wall sliding. I was using it in another capx and found it to be a very clean way to do the wall sliding. I'll try to extend it into a plugin one of these days if I get time.

    https://dl.dropboxusercontent.com/u/5426011/examples21/sat_push_aabb.capx

  • If sin(a-b)>0 then a is clockwise from b.

  • spongehammer

    Pasting a paster object to itself is no longer permitted by the runtime.

  • You can use a regex expression.

    Using the "test regex" system condition with

    "77,1,6,7,3,17" as String

    "\b7\b" as Regex and

    "" as Flags

    It will only be true if a 7 by itself is in the string, no false positives.

    Here is a reference for regex expressions:

    http://www.w3schools.com/jsref/jsref_obj_regexp.asp

  • The simplest way would be to use the Browser.ExecJS() expression. Although the "^" is different in js, so that will have to be worked around. It is appealing to make your own parser so only certain syntax is allowed as ExecJS allows all of Javascript to be used. The problem is it can be tedious to implement.

    Here's the approach I would take:

    1. Get the text for the formula.

    2. Break it up into a list of tokens (numbers, symbols). Regular expressions can be used here or scanning over the text a character at a time, tokenat isn't suitable. Error checking is done here as well to look for invalid syntax.

    3. Convert the token list from infix notation (1 + 1) to reverse polish notation (1 1 +) as in that form it's simple to evaluate.

    4. evaluate.

    http://en.wikipedia.org/wiki/Reverse_Polish_notation

    There are other ways out there as the topic is pretty vast. You'll end up writing a lot of events (or code) to get something working well.

  • Hi Zetar,

    I finally got around to looking for a solution to this. The formula for the initial velocity from wikipedia is:

    v=sqrt(G*M/r)

    where G is the gravitational constant, M is the mass of the object being orbited and r is the distance. Since we aren't dealing with real distances we can just use 1 instead of G.

    In my tests I didn't use the gravitation plugin, instead I just applied a gravitational force to the planet every tick:

    G*m1*m2/r^2 or

    sun.Physics.Mass*Self.Physics.Mass/distance(sun.X,sun.Y,Self.X,Self.y)^2

    applied toward sun.x,sun.y

    The biggest issue was that box2d units are odd so I had to find a conversion factor, which ended up being about 48.8.

    So my final formula for the planet's impulse was:

    Self.Physics.Mass*sqrt(sun.Physics.Mass/distance(sun.X,sun.Y,Self.X,Self.y))/48.8

    Plugging that into your capx worked, but the orbits aren't perfectly round when using the gravitation plugin.

  • You get the motion because x and z are being changed every time and their values are used in the formulas.

    Here is the reference I used:

    http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/2drota.htm