R0J0hound's Forum Posts

  • Use the wallClockTime expression.

  • kirksl

    I do see your point, but I guess there are always use cases that just don't work with many things.

    Anyways it wouldn't hurt to file a bug report I guess. That way you could get an official response. I do think that the issue was filed before, so maybe a search could find it.

  • You're comparing every pair of numbers and only add to new numbers that don't match.

    So for example if your lists are

    My=1,3,4

    Del=2,4

    Then all you comparisons would be:

    1=2

    1=4

    3=2

    3=4

    4=2

    4=4

    So your readily is:

    New =1,1,3,3,4

    What you want is to to know is if the current number from my list is in the delete list before adding it to new. Here is one way. Hopefully the event nesting is evident.

    For each my_list

    --var save=1

    --for each del_list

    ----if cur_my = cur_del

    ------set save to 0

    --if save=1

    ---- add cur_my to new

    Another way would be to use find() by converting the delete list from:

    1,3,5

    To

    ,1,3,5,

    Then you could do this:

    For each my_list

    --if find(del_list, ","&cur_my&",") = -1

    ---- add cur_my to new

  • Prominent

    I can't open your capx right now but when the animation frame is changed the collision shape is recreated. The only way for it to know if the collision polygons of two different frames are the same is to compare all the points, which may be slower than just recreating it. Also note changing size also causes the collision shape to recreated as well.

    So to the physics engine it's a new shape, so it causes a new collision. I guess a workaround in the plugin would be to modify the collision shape instead of recreating it, but there are many caveats with that, and that's something that's absent from the chipmunk documentation so it's not really something it was designed to do.

    Anyways the solution is to not change the frame on physics objects. If you want to change appearance, use a seperate object.

  • Look at the blend modes template that comes with C2.

  • If the object is going 2000 pixels per second it then moves 2000/60 or 33 pixels in one frame. If the framerate ever goes lower than 60 then the distance moved in a frame will increase.

    Solutions include checking in between positions for collisions, or stretching another Sprite as a line from the old position to the new and check collisions with that. Alternately you could also lower the speed or make the obsticles thicker. If you use the the physics behavior you can check "bullet" collisions for objects to solve the issue internally.

    There have been other topics on this with examples of solutions.

  • zebios

    This was an add-on for the original version of Construct and not Construct 2. As mentioned above it's not possible to make a plugin exactly like this using C2's SDK. For it to be official Scirra would have to make their own version.

  • You can rotate a point around another using a formula like the one here:

    https://www.siggraph.org/education/mate ... 2drota.htm

    And here's a cursory example of that applied:

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

    You could probably do it with less math, but I'm not feeling especially creative.

  • It probably isn't a mistake since it's a format used throughout C2. Here's how the rgb() function in converts it to a single number.

    Number = red & (green<<8) & (blue<<16);

    There isn't a standard color format but if I may, here's a shorter way to convert it to the format you want:

    function hex2rgb(hex)

    {

    return {

    r: hex&0xff,

    g: (hex>>8)&0xff,

    b: (hex>>16)&0xff

    };

    }

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't follow the last post, it looks different than what was originally asked. Here's my solution for the op.

    Global redboxcounter=0

    On redbox created

    --- add 1 to redboxcounter

    Redboxcounter >= 20

    --- subtract 20 from redboxcounter

    --- create bluebox

  • You could look at the json plugin by yann and see if that's something you could work with.

    Alternately you could use the browser object to access the info.

    First step is to get the json data into a variable. Options include:

    * using the Ajax object to get a file added to the project or even from a web address.

    * pasting it into a textbox when you run the game.

    * creating a variable and pasting it as the initial value.

    * using the set variable action and pasting it there. For this one you'll need to first replace all the " with ' and put a pair of quotes around it.

    Ok, so you get the json data with one of those methods and put it in a variable, you then run this action:

    Browser: run js "window.myjson=" & variable

    Then barring any js errors you should be able to access any value in the json with something like:

    Browser.execjs("myjson.presentations[0].name")

    It's just JavaScript so it maybe learning a bit of that could be useful.

    Presentations is an array so the above accesses the first one and gets it's name. At least it should, unless I made some typo.

  • The numbers are somewhat arbitrary. Just know that higher values mean those operators should be done first. The "(" probably didn't need to be in there but I think I added it to assist with error checking. Also I ended up hard coding neg as being right associative.

  • Does the plugin cease to work if you minify as it is now? If your plugin is the only js that accesses the library, and you included the library as a dependency then I'd think there was no reason to change anything in the library.

  • If you limit your variables to a single character then you could make AB the same as A*B. However you'd need to make your own parser instead of using javascript.

    I've done one before here:

    viewtopic.php?f=147&t=153525&p=967756&hilit=parse#p967756

    It's not a plugin and I don't have plans of making any more plugins.

    Here's a more recent example:

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