Ashley's Recent Forum Activity

  • I can reproduce, but as soon as I switch to a layout tab it re-enables. Are there situations it never enables?

    If you open a project and the first tab is an event sheet, it's not clear what layout should run when you press Run Layout (for example, the event sheet could be included by 5 other event sheets, so which is its associated layout?). So C2 waits until you switch to a layout tab to know that's the layout you want to run. You can always right-click and run in the project bar, too.

  • BTW I can't seem to find that error message anywhere in the source code, are you sure it said exactly that? Was it a messagebox or a balloontip?

  • First of all, some tips:

    • script didn't run at first because you don't declare 'i' and 'len' before using them in some places (remember C2 scripts run in strict mode)
    • don't use 'this.memberFunction = function(...' to make member functions. Add them to the prototype, e.g. 'behinstProto.memberFunction = function(...'. If you assign a function to this.memberFunction, each instance of the behavior gets its own copy of the function which wastes memory.
    • those conditions are pretty expensive O(n^2) - you might want to build in, or at least encourage users to use, some kind of timed update (like every 500ms, rather than every tick). IIRC the Classic turret behavior updates the range checks every 500ms.

    The main problem:

    You wrote in a comment "C2 will invert the picking automatically for us". It doesn't! It only inverts the result of the condition function (return true/return false). C2 has no idea what the body of your function does and has no control over it. The way you've written it, you pick objects within range to the SOL even when the condition is inverted. You have to handle inverted yourself in this case, which is done like so:

    // Get the inverted status of this condition
    var cnd_inverted = this.runtime.getCurrentCondition().inverted;
    
    // ...
    var i, len;
    for(i = 0, len = instances.length; i < len; i++)
    {
         obj = instances[i ]; // forum makes this italic if i don't put a space
         
         // 'xor' handles the invert flag
         if (cr.xor(this.withinAngle(obj.x, obj.y), cnd_inverted))
              picked.push(obj);
    }
    
    if (picked.length)
    {
         sol.select_all = false;
         sol.instances = picked;
         return !cnd_inverted;  // C2 inverts the result
    }
    else
    {
         return cnd_inverted;  // C2 inverts the result
    }
    

    A little explanation:

    XOR computes invert, because of its truth table. See:

    A = object met condition

    B = invert status

    A - B - Result

    0 - 0 - 0

    1 - 0 - 1

    0 - 1 - 1

    1 - 1 - 0

    So if you XOR your picking condition with the invert status, you'll pick it correctly for all combinations of object meeting the condition and condition being inverted. That's what I've done above.

    The next trick is remember C2 inverts the result of your condition function if the condition is inverted. If the event is inverted and we picked no objects, and return false, C2 inverts false to true (because it's inverted) and the event runs. Woops! So to counteract this, the returned value from the condition has to be inverted too. In other words, if nothing was picked, we want to return false if the condition was not inverted, or true if the condition was inverted - i.e., the invert flag itself. And vice versa for if we did pick objects.

    Hopefully that makes sense - once I made those changes to all three conditions, it seems to be working ok now!

  • Oops, 'spawn' only picks the last 'bullet' that was created. I've fixed for the next build - it'll pick all of the instances created, so all bullets are affected.

  • I've made one more shotgun fix for r51.2. Should be out today or tomorrow. Have another go then...

  • I didn't know some systems didn't have Arial installed. What OS and language are you using? If it works OK after loading anyway, maybe I can just remove that message.

  • If you crop each frame that you import, it will remove any wasted space. (You might need to wait until we have hotspots for this to work smoothly though.) Once each frame is cropped, AFAIK the download size is not much more than a sprite sheet and the VRAM usage is about the same as well. Modern graphics cards support non-power-of-two textures so there's no memory wasted by having lots of different frames.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • We're working hard to get this and a whole bunch of other features in C2. Just hold on a while and we'll see what we can do!

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Closest thing I can think of would be renaming all your images to random strings and updating the references in the runtime.

    I'll do this in a future build. I don't think there's much to be gained by obfuscating the images themselves. While they would only need to be de-obfuscated on startup, it could pause for several seconds while it processes everything, and like Candescence says it doesn't stop the "printscreen attack". So I think just making it a little harder to track down images should be as far as it's sensible to go.

Ashley's avatar

Ashley

Online Now
Early Adopter

Member since 21 May, 2007
Last online 20 Oct, 2026

Twitter
Ashley has 1,828,777 followers

Connect with Ashley

Trophy Case

  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • Forum Mega Brain Made 20,000 posts in the forums
  • x126
    Coach One of your tutorials has over 1,000 readers
  • x74
    Educator One of your tutorials has over 10,000 readers
  • x5
    Teacher One of your tutorials has over 100,000 readers
  • Sensei One of your tutorials has over 1,000,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x44
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

32/44
How to earn trophies

Blogs