R0J0hound's Forum Posts

  • If you create another variable and call it old_state then you can get the same result with an event like this:

    Sprite.state != Sprite.old_state

       set sprite.old_state to sprite.state

       do other stuff

  • He's suggesting adding a color parameter type to shaders. Right now we only have "float" or "percent" parameters.

  • ouldn't be much more work (check variable, is carrying box? yes -> spawn box and set to player xy) but maybe someone else has a better idea :)

    You could also leave the boxes as global and destroy all the boxes not being carried at the end of the layout. This would work since all global means is the object won't be destroyed at the end of the layout.

  • ith objects overlapping I trust you only refer to the ones that are colliding?

    Yeah, but let me clarify, C2 treats both objects in contact and objects on top of each other as colliding. For the algorithm used I mean the latter, objects on top of each other.

    e are going to show the pool table at an angle, and in order to not have to further compensate balls colliding with an angled surface, I figured we'd use the Mode7 plugin you posted not too long ago.

    Here's a test I did: dl.dropbox.com/u/22615804/bbbb-mode7/index.html

    We're not gonna rotate it and such during gameplay. I'm only using the effect to get the table angled.

    With that you're going to need to figure out the perspective transform to map the balls to the correct positions on the table. I haven't done this myself yet but here is a link that has the math:

    http://www.coranac.com/tonc/text/mode7ex.htm

    ow many collisions did you consider many? I haven't noticed any slowdown. It stays at a nice 59-61~ FPS for me. Though I recently upgraded and am now running an i7 system, which could explain it. The primary target platform is Ouya though, so if it's too heavy, that could be an issue.

    If I double the object count it noticeably stalls when about five or more collisions occur, but it may very well be due to my 1.5ghz single core 10 year old computer. There is a lot that could be done to make it go faster, such as calculating the time of collision instead of iteratively finding it and using a spacial hash of some sort so collisions are checked against only the other nearby balls instead of all of them. In my capx the most blaring inefficiency is collisions are checked between every ball with all the others twice. It could be improved to once if the collision pair were saved to a list somehow.

    also noticed that there's constant motion. Even if a ball comes to a stop another one soon enough bumps into it and sends it off with renewed force. Though I'm sure it's not too hard to fix.

    Yes it's pretty simple to change the formulas to take into account acceleration for friction. The elasticity can probably be changed from 1 (perfectly elastic) to 0.9 so that it's more realistic.

  • Instead of "for" use "repeat 6 times" and instead of loopindex use:

    Array.Height-loopindex

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could something like this:

    global number max_value=0

    every tick:

    Set max_value to max(var1,var2,var3,var4,var5,var6)

    max_value=var1:

        do stuff

    max_value=var2:

        do stuff

    max_value=var3:

        do stuff

    max_value=var4:

        do stuff

    etc...

  • Those two conditions are triggers as defined in edittime.js:

    AddCondition(3, cf_trigger, "On went online", "Browser", "On went online", "Triggered when user is offline and a connection becomes available.", "OnOnline");
    AddCondition(4, cf_trigger, "On went offline", "Browser", "On went offline", "Triggered when user is online and the connection becomes unavailable.", "OnOffline");

    The following code from runtime.js is what causes "OnOnline" to be triggered:

    window.addEventListener("online", function() {     self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOnline, self);
    });
  • If that's the case then here is an updated version that is easier on the eyes among many other things:

    http://dl.dropbox.com/u/5426011/examples16/nodes3.capx

    FYI the nodes evaluate somewhat like a circuit so values can take time to move through the nodes.

    What's your project about?

  • If I can't get 1 to work the way I want it I usually skip 2 and 3 and go straight to 4, because at that point I have full control of what happens. The math isn't too bad since you can find tutorials that have the formulas ready for you. Collision response will probably be the most involved aspect.

    For an exercise I followed the tutorial here:

    http://chrishecker.com/Rigid_body_dynamics

    And made a capx:

    dropbox.com/s/n7lb5l40uc2g259/2dphysics.capx

    I skipped the angular motion, and it will lock up if you design a layout with objects overlapping, but other than that it looks alright. The collisions are pretty crisp due to the method used in the tutorial, but it's pretty slow when many collisions occur at once.

    I tried reproducing it with the physics behavior and I can't get it to act the same. The break doesn't look as good and there is energy loss.

    dropbox.com/s/9bl7uywsfk0d9h2/2dphysicsbehavior.capx

  • While it's true that transparent sprites are still rendered, if you make a sprite invisible it isn't rendered at all.

  • It can be done with the erase effect:

    http://dl.dropbox.com/u/5426011/fixed/robit_studios.cap

    Layer 2 has "force own texture" checked and the erase effect was given to the grey tiled background.

  • I'd like to add that you can do ranma's method without an instance variable. Just use random(1) as the expression in for each ordered.

  • Use SOL.Sprite to access the newly created sprite.

    System.Create("Sprite", 1, 0, 0)
    SOL.Sprite.angle = 45

    SOL stands for "selected object list" and allows access to what was picked with events.

    For your example it's better to get the sprite count with Sprite.Count as new objects are not added to the list until after the next toplevel event.

  • Using an array would be faster for the flood fill, but it may take more events.