dop2000's Forum Posts

  • When adding or subtracting health, use clamp expression.

    Set health = clamp(health+1, 0, 100)

    Or if health can be greater than max, then use clamp() or min() in the formula where you calculate healthBar width.

    set healthBar width to clamp(health, 0, 100)

    or

    set healthBar width to (healthBar.ImageWidth*min(health,100)/100)

  • You can do this without families. Just move event #8 from under #6, to make it top-level event.

    Add a condition "RedBlock is NOT dragging".

    The only problem is that both overlapping redblocks will be destroyed. If you want to destroy only the dropped one, you can do something like this:

    Redblock on drag start -> Move to top of layer
    
    Redblock on Drop -> (all your other checks)
    
    Redblock is overlapping Redblock
    Redblock is NOT dragging
        Redblock pick top  -> Redblock destroy
    [/code:3l68wi0x]
  • Hey Jules, no worries!

    Glad I could help. Merry Christmas to you too!

  • You have "Wait 7 seconds" inside of "Every random() seconds" loop, this can cause all kinds of problems..

    You basically start lots of delayed "set bombSkill=0" actions. When you press Q the second time, some of those delayed actions may still be running, that's why your bombing stops early.

    Try not to use long running "Waits" for tasks like this, use Timer behavior instead.

    On Q pressed
    bombSkill=0
        Set bombSkill=1
        skillSpawn start Timer "StopBombing" for 7 seconds
    
    If bombSkill=1
        Every random(02, 04) seconds -> Spawn bombs
    
    skillSpawn On Timer "StopBombing"
       Set bombSkill=0
    [/code:2oce63v9]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's hard to tell by just that screenshot, but shouldn't it be "EnemyRight set speed 900" in event #7?

    If event #6 works correctly, this means that the angle of motion of EnemyRight is 180 degrees. So setting positive value to speed should move it from right to left.

  • You can add all cards into an empty array, sort and then check if cards there are in order:

    Is it possible that these cards are played: 5-3-1-2-8?

    Should it be recognized as a 3-card run? If it should, then you'll probably need another event that loops through all elements in this array and counts the number of consecutive cards.

  • And if you don't actually need Physics, you can do this without any behaviors at all:

    https://www.dropbox.com/s/1mtx5omp7f314 ... .capx?dl=0

    It's based on R0J0hound's example from this post:

    spaceship-movement_t198897

    So all kudos to him!

  • The first example didn't work, because On Start of Layout the bullet is not even created yet, and of course hasn't traveled any distance.

    So the way you fixed that was absolutely correct.

  • I believe what happens is in "On RedBlock drag&drop Drop" the system picks just 1 RedBlock instance, the one you dropped.

    Then inside this event you check "If RedBlock overlapping RedBlock" and because there is only 1 instance picked, this sub-event will never be true.

    There is a simple workaround - create a family with just one RedBlock sprite, name it RedBlockFamily.

    Then you will be able to do this:

    On RedBlock drag&drop Drop
         If RedBlock overlapping RedBlockFamily
             RedBlock destroy
             RedBlockFamily destroy  // if you want to destroy both red blocks
    [/code:1az76nse]
  • So you need to set movement direction to ship's angle, not the other way around!

    Sorry, I misunderstood you.

    Here is another demo, I think it's what you want:

    https://www.dropbox.com/s/9rjbrl0wpc1zz ... .capx?dl=0

  • You don't really need sprites, you can use "overlapping a point", should be a bit faster. Also, when the ground curves inwards, you need to check overlapping higher than the character's feet level.

  • Man, your code is soooo overcomplicated...

    Your error is in events 25-28.

    You need to move "Set QScount" action before "Call CheckAnswer function".

  • Your game is quite big. Please give more details about the issue - how to reproduce it? What is happening? How is it supposed to work? Which events should I look at?

  • You shared .caproj file, it's not enough to open your project.

    You should save your project as a single file (with .capx extension) and share it.

  • It's not.. Here is how I see it:

    http://www.dropbox.com/s/7mmbbo1mhz6fg3 ... aproj?dl=0 [/code:2rmnkike]