R0J0hound's Forum Posts

  • How are you getting the string into construct? Pasting it into a variable? Or is it happening when loading a file from Ajax?

  • Newer versions of the chipmunk library can have segments collide with segments, but it wasn't ported to JavaScript when I made the plugin.

    I'm guessing you got that error because the inertia was set to zero. Maybe because of zero area. Just make it a hair thicker.

  • MathNook

    That's all the terrain that was generated, and after that it goes to 0. Changing the size of the array will change how much is generated.

  • You can do more but it starts to look hairy.

    op="+" ? var1+var2:(op="-" ? var1-var2:(op="/" ? var1/var2:(op="*" ? var1*var2:sqrt(-1))))

  • Without families you can't pick two separate instances to pin them together. You'd either have to have two different object types and alternate them on the chain or do the pin manually with events.

  • You have to write it like this:

    (MathOpIndex = 1) ?VarX1*VarX2 :VarX1/VarX2

  • Here are some topics I found on the matter:

    There are probably more. The gist of what happens is the wait delays the following actions till later, the function ends, and when the actions finally run the parameters are no longer there.

    The cleanest solution is probably not to use that wait 0 trick at all. The events in your pic can be made like this and operate the same.

    every 4 seconds

    --- create sprite at random location

    --- call function "detect"

    on function "detect"

    --- sprite: set blend to source out

    But in the context of what you want to do you can pass the uid to the function and you can pick the new sprite "by uid" and you can pick the rest of the instances with "pick all". To make things simpler a family can be used like below:

    // family "otherSprite" with object type sprite

    every 4 seconds

    --- create sprite at (random(640),random(480))

    --- call function "detect" (sprite.uid)

    on function "detect"

    sprite: pick by uid function.param(0)

    while

    sprite overlaps otherSprite

    --- sprite: set position to (random(640),random(480))

    And just for completeness if you want all the instances to be picked you can set variable or enable a group to run events. There's an example for zordering in the bottom of the post here:

  • Usually a family is needed to do that. Look here for an example:

  • If you have the text in a var you can remove the " with:

    set var to replace(var, """", "")

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • pick by uid can pick the new objects at any time. It is the exception to the rule.

    Functions and "on created" are run as if they were placed where the object was created or where the function was called. So no, they are not top level. For example:

    this:

    +-------------------+
    | on function "move"| sprite: set x to self.x+32
    +-------------------+
    +-------------------+
    | on sprite created | sprite: set opacity to 50
    | pick all sprite   |
    +-------------------+
    +-------------------+
    | start of layout   | create sprite at (0,0)
    |                   | call function "move"
    +-------------------+[/code:rahmbimr] is the same as this:
    [code:rahmbimr]+----------------------+
    | start of layout      | create sprite at (0,0)
    +----------------------+
       +-------------------+
       | pick all sprite   | sprite: set opacity to 50
       |                   | sprite: set x to self.x+32
       +-------------------+[/code:rahmbimr]
    
    For the case of needing to do something to all the instances right after a new instance is created I usually use a   variable or a group that i set or enable when i need to do something.
    
    global number zsort=0
    
    sprite: on created
    --- set zsort to 1
    
    start of layout
    --- create sprite at (10,10)
    
    zsort=1
    --- sprite: sort
    --- set zsort to 0
  • Have you tried re-uploading the images?

    when i go to the image url with the browser the image doesn't show.

    http://snya.comxa.com/test4/images/sprite-sheet0.png

  • The main issue is sprites can't be skewed. So without third party plugins the best you can do is fez like rotations:

    Of course you may be able to do an isometric view with lots of animations of the the cube rotating.

    Alternatively you can skew images with the paster plugin. You can look here:

  • It's not really a bug, it's just doing it how the javascript % does it. Also apparently there isn't a consensus in the computer world what % should exactly do when one of the values is negative. See here, the sign of the result varies depending on the language:

    https://en.wikipedia.org/wiki/Modulo_operation

    For an always positive remainder you could do one of these:

    (a%b+b)%b

    a-int(a/b)*b

  • A quick way would be to use a variable like this:

    global variable once=0
    
    on collision
    once=0
    --- set once to 1
    --- do stuff
    
    every tick
    --- set once to 0[/code:239878ee]
    
    That way you'd only get one event per tick on that object type.  Actually you'd want an instance variable instead to have one collision per instance per tick.  Or if you wanted only one trigger per pair of instances you could use a dictionary to keep track of it like:
    
    [code:239878ee]on collision
    X dictionary: key exists min(sprite.uid, sprite.chipmunk.otherUID)&":"&max(sprite.uid, sprite.chipmunk.otherUID)
    --- dictionary: add key min(sprite.uid, sprite.chipmunk.otherUID)&":"&max(sprite.uid, sprite.chipmunk.otherUID)
    --- do stuff
    
    every tick
    --- dictionary: clear[/code:239878ee]
    
    I do not know if the chipmunk library has anything to help with that.
  • https://dl.dropboxusercontent.com/u/542 ... rsect.capx

    dist = distance between centers

    ang = angle from one center to the other

    Then from the first center you move r0 pixels at angle ang+acos((r0^2 -r1^2 +dist^2)/(2*dist*r0)) to get to the left intersection point. You can also use -acos to get the right intersection point.