R0J0hound's Forum Posts

  • That's odd, I haven't encountered that. Sounds like a bug since I'd assume no events run during loading. Also "getObjectByUID" isn't just called when using "pick by uid", it's a helper function that's used elsewhere.

    If you put a breakpoint inside the function definition of "assert2" (i think it's in common.js), you could then look at the call stack to see what functions were called before that. Still, that may not give you anything useful.

    If it's your events causing it, i'd be it would be under a trigger. If it happens in the "on created" or "on destroyed" triggers then I'd say it's a bug to report. What other triggers do you use?

  • Tokinsom megatronx and anyone else I linked here before.

    Update:

    Here's a more generic version of my above capx:

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

    It no longer uses imagepoints, instead it calculates the corners regardless where the object's origin is. Also it's not tied to a particular sprite anymore, but you do have to duplicate an event or two to support more types (documented in capx).

  • tulamide

    QuaziGNRLnose

    I had a go at quazi's idea here:

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

    It was getting to tedious to get a nice formula from the equations, so I ended up putting all the formulas into a matrix and used guass-jordan to solve as a system of equations. Every time I change "m" I use that to recalculate the coefficients.

    Using an x^3 polynomial wasn't working right. It looked good when "m" was centered, but the amplitude would get crazy otherwise and the shape would lean. It ended up needing a x^4 polynomial, or 10 coefficients. For 10 unknowns I needed 10 equations: Three equations per piece (S0(x) and S1(x)) for the points. Two for the single derivatives between the pieces and two more for the double derivatives. That mess of formulas is in the bottom of js.txt.

    Anyways hat's off to quazi for the idea. Testing it it seems the limit for m is 0.5 to 1.5, beyond that the shape gets crazy.

  • Sourav21

    The canvas plugin is different, it can't paste effects.

  • Quansi's idea is probably the ideal way to go about it, since it's known to work.

    I came up with an iterative way here:

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

    Changing the k parameter from 0 to 1 controls the center position. It has the desired shape, but it's not in a useful format yet.

    It still needs to be offset to align it, and it needs to be scaled to be the correct ranges.

    My guess is there may be a way to manipulate the equations to be in the form of one function that gives a y for an x. I may have a go at that later.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sourav21

    This post has a fix for the bug of pasting stuff with effects. I've been lazy and haven't updated the plugin yet.

    By "canvas" it means the view, that's what it tries to load. If you mean the whole layout instead you could try changing the sytem->canvas size to 2000x2000, wait a frame, paste, then set the size back to the original window size.

  • Fun problem!

    I had to have a go at it, but it's not the simplest.

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

    Dropping leaves has never been so much fun.

  • You could use the clamp() expression.

    every tick

    set variable to clamp(variable, 0, 10)

  • If that gets the first word this will get a random one:

    tokenat(AJAX.LastData,int(random(tokencount(AJAX.LastData,","))), ",")

  • The visual event sheets of C2 are the principle way to code logic. You could use the plugin sdk and use JavaScript but it's not really a replacement for events.

    You also can run snippets of js with the browser plugin but it has no access to the rest of c2.

    The request to use scripting instead of events has been made before, and it won't be added.

  • This should do it I think. The "---" means subevent.

    Start of layout

    gamearray: set size to (array1.width+array2.width, 7,1)

    --- array1: for each xy element

    ---> gamearray: set at (array1.curX, array1.curY, 1) to array1.curValue

    --- array2: for each xy element

    ---> gamearray: set at (array2.curX+array1.width, array2.curY, 1) to array2.curValue

  • It's just an image so the rough process is to:

    1. load it into a sprite

    2. paste it into the third party canvas object

    3. loop over the pixel with two for loops

    4. look at the color and do something with it.

  • If the arrays are one dimensional (ex: with size (n, 1,1)) then you could do this:

    start of layout

    gamearray: load from json string Array1.AsJSON

    ---- array2: for each x element

    ----> gamearray: push back array2.curvalue on x axis

  • Phealin

    It's very doable, and a sort isn't needed.

    You can use "repeat" or "for" to loop over the letters.

    Use the len() expression to set the length of the loop, then the mid() expression to get the individual letters.

    Next you need to convert the letters to a number. You could do it the long way by making an event for each, or you could use the find() expression [expained below].

    Wrapping the value around when adding a number can be do by using the % operator.

    Finally converting the number back to a letter can be done with mid() in a similar way to using find().

    As an example the following should encode your text.

    Global text input="hello"

    Global text output=""

    Start of layout

    set array size to (7,1,1)

    set array at 0 to 6

    ...

    set array at 6 to 2

    Global text letter=""

    Global number value=0

    Start of layout

    Repeat len(input) times

    set letter to mid(input, loopindex, 1)

    set value to find("abcdefghijklmnopqrstuvwxyz", letter)

    set value to (value+array.at(loopindex%array.width))%26

    add mid("abcdefghijklmnopqrstuvwxyz", value, 1) to output

    That works any input that consists of only lowercase letters.

  • zenox98

    That's the one. That's no good if it's not connected to the reporting system.