dop2000's Forum Posts

  • If you have a lot of objects on the screen, pasting them all onto a drawing canvas may be difficult. In this case take a snapshot of the entire screen, load it into a temporary sprite, paste a portion of this sprite onto the canvas.

    Also, please vote for the idea to add "paste layer" option to drawing canvas:

    construct3.ideas.aha.io/ideas/C3-I-921

  • If you don't necessarily need them to fade out over time, you can paste these sprites onto a Drawing Canvas and then delete the sprites. It will definitely be better for performance than having 2000+ fading sprites.

  • What behavior are you using? You need to provide more details, it's not clear what you want..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assuming your array contains image names and text questions - pick a random array index, create a picture, delete this index.

    Local variable r
    
    Set r to int(random(array.width))
    Create picture, set animation to array.at(r,0)
    Create question, set text to array.at(r,1)
    Array delete index r
    
  • You do not have permission to view this post

  • In C3 you can do this with Drawing Canvas. Paste your image to multiple small Drawing Canvas objects, after that you can remove the image and re-shuffle the pieces.

  • No, when "On touch end" is triggered, the screen is still considered in touch. So you can still check for "Is touching object".

  • Most of your code is what's called "state machine". You have a bunch of variables and checking their states on every tick.

    I prefer keeping everything in triggers and functions, this code is shorter, cleared and much better for performance.

    Here is an example of state machine code:

    On collision with Enemy : Subtract 10 to health
    
    On collision with HealthPotion : Add 10 to health
    
    If health>100 : set health to 100
    
    If health<=0 : Set isDead=true
    
    If isDead=true : Player start animation "dead"
    
    and so on....
    

    There are too many events, most of them running on every tick.

    Here is how I would do it:

    You can call the function from other events, where the player gets hurt.

  • I have no idea why you need all this and why you have "ray-casting" in the subject. But the easiest way to check if a point is inside the object's hit box is to use "System Pick by overlapping point" event.

    So on touch end you can pick Button by overlapping (Touch.x, Touch.y) and that's it. You can also check if Button is overlapping (OldTouchX, OldTouchY).

    I believe "Is touching object" condition also uses object's collision polygon.

  • No, in the first event don't append to the text! Set charTyped value to lowercase(Keyboard.....)

    Add another sub-event below the "Shift is down" and there append charTyped to the text.

  • yes, CharTyped is a text variable. You can append it to your text.

    If you do it correctly as on my screenshot, you will be able to type special characters with Shift key.

    When Shift is down, it will search for CharTyped in charsNormal string, and then replace it with the character at the same position from charsShift string. "a" will become "A", "2" will become "@" and so on.

  • Never use "Wait" and "Every X seconds" with long duration when programming game mechanics. You have no control over these events. "Every 20 seconds" may fire when you just started the level, as it's based on the project time, not on layout time. "Wait 5 seconds" is also bad, because in these 5 seconds something may change (the boss may already be dead for example), and you can't cancel the scheduled actions.

    Use Timer behavior instead. You can pause or cancel the timer, check the remaining time, run different timers for different object instances etc.

    .

    Another issue with your code is that most of your events are running on every tick. This is bad for performance and makes the code difficult to manage. But most importantly many of these events are not supposed to be run on every tick, for example events 9-12 will create lots of duplicate text objects.

    Instead of a "state machine" with dozens of global variables, use triggered events and functions.

  • Here is how I did it in one of the projects:

  • For the record, here are all the features of a popular Pin+ addon, some of them are quite useful and it will be nice to see them implemented in the official behavior:

  • This an ok way of doing it or a bit of a bodge job?

    No, it's not an ok way of doing it.. Add "System trigger once" condition to "Life<=0".