R0J0hound's Forum Posts

  • Outside of an effect the paster plugin has a draw quad action that could be used to do a skew of an image. You just need to calculate the positions of each corner. I think there is a capx on the paster topic demonstrating the action.

  • The math as newt wrote works. As you wrote it is incorrect, you added some parenthesis that weren't there.

    Edit:

    Well, since I posted you edited your post or some nonsense like that. So now the formula is correct and the numbers look to be in the range you'd expect. If you want to be more sure of the formula then I recommend reading up on converting polar coordinates to Cartesian coordinates.

  • As a start you could download the canvas plugin. With it you can draw shapes and such. It's topic has some examples that help show it's use. The only documentation it has can be seen when adding events in the event editor.

  • What newt said, I always forget something if I don't actually implement it.

  • Looking in C2's exporters directory I found that yes, javascript's Math.random() is used for random. But the algorithm used is left up to the browser's javascript engine as per the Javascript spec. However generally from what I found they all use Linear congruential generators. But I didn't bother to look further to see if anything has changed with newer browsers.

  • Basically this:

    newX = oldX + 10*cos(angle)

    newY = oldY + 10*sin(angle)

    But depending on the programming language you may need to convert the angle from degrees to radians.

  • Another idea is to try removing the else condition. As I recall the else will only be run if nothing was picked in the event above.

  • RenatoB

    It doesn't work 100% because the newly created object can't be picked in the function.

    The solution is to either add a wait 0 before calling zorder or just run it every tick.

  • hopr37

    Other than changing the sprite sizes from 133 you'll also need to change all the 133's to the new size. That and reposition the sprites in the editor to be positioned on a grid size of the same value.

  • You can create a var in JavaScript with for example execute js( 'this.premium=1337‘ ) and just set your global with an event with eval js( 'this.premium'). That will work with minifying as well. As a rule of thumb it's not reliable to access the runtime stuff unless you use the sdk with a plugin.

  • Instead of using the warp behavior do an event like this:

    Bkgd_road: Y>480

    --- Bkgd_road: move 480*2 pixels at angle 270

  • You need to add quotes in the expression around the encoded string, otherwise js thinks it's just a long variable name.

    Try this. Notice the added single quotes.

    Browser.ExecJS("window.var ='" & AJAX.LastData & "';")

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can redirect print() to output to an editbox by running this script at the start of the layout:

    class output(object):
    	def write(self, message):
    		EditBox.AppendText(message)
    sys.stdout = output()[/code:17j2ia61]
    
    Input could be done similarly but it's more complicated since you need a way to get input.  AKA no simple solution exists.
  • Not a bug.

    The correct way to use the distance function is:

    distance(Pos1.X, Pos1.Y, Pos2.X, Pos2.Y)[/code:1czenn2n]
    Notice the x,y pairs are next to each other.
    
    It's exactly the same as:
    [code:1czenn2n]sqrt((Pos2.X - Pos1.X)^2 + (Pos2.Y - Pos1.Y)^2)[/code:1czenn2n]
    or
    [code:1czenn2n]sqrt((Pos1.X - Pos2.X)^2 + (Pos1.Y - Pos2.Y)^2)[/code:1czenn2n]
    
    The abs() isn't needed since any number squared is always positive.