dop2000's Recent Forum Activity

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

  • 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
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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:

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 279 followers

Connect with dop2000

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • 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
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x14
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

30/44
How to earn trophies