Minor's Recent Forum Activity

  • That randomly chooses either 1,2,3,4,5,6 or 7 to add to your score.

    I used it for 2 reasons:

    1. I have no idea how your scoring works so it was easy for me to make for the example.

    2. It shows that whatever you add to your score every 10 point's will create an object.

  • How about this.

    [attachment=0:mdawi7o9][/attachment:mdawi7o9]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using donelwero method here is a quick working version.

    [attachment=0:1k5dyv3s][/attachment:1k5dyv3s]

  • If you use distance(attack_detect.X, attack_detect.Y, enemy_hitbox.X, enemy_hitbox.Y) you would be checking the distance of a diagonal line which will be longer than a straight line. Basically I'm getting just the distance from attack_detect.y to enemy_hitbox.y

    It may not make much of a difference for what you are using it for but can give results that people may not be expecting like

    HERE

    Hope that sort of makes sense.

  • Yes there is a new stable release R173 you should update to that version.

  • I'm not 100% sure but I think this is what you are after.

    [attachment=0:1uz9oevi][/attachment:1uz9oevi]

  • My example already does that as the distance calculated is from the enemy_hitbox origin (top/middle). It doesn't use Y co-ordinate of the screen at all.

    I've added sine movement to the enemy_hitbox in my previous example but changed nothing else. Keep the player sprite still while overlapping the enemy_hitbox and press space while the enemy_hitbox is moving and watch the distance change.

    [attachment=0:a2r410e6][/attachment:a2r410e6]

  • While beaten by OddConfection's answer I spent a few mins making an example so I'm going to post it anyway

    [attachment=0:25a06spn][/attachment:25a06spn]

  • I'll try to explain see if I can make sense

    You were getting the distance using "fireball" X&Y to "moving platform" X&Y, so distance(fireball.x,fireball.y,movingplatform.x,movingplatform.y). So it's actually calculating the length of a diagonal line which is why your version always seemed to be longer than it should.

    My version used distance(fireball.x,fireball.y,fireball.x,movingplatform.y) so since the "X" stayed the same the line calculated is straight.

    Hope that makes some sort of sense. I'm bad explaining with words that's why I usually create examples.

  • Here's a fixed version. I think it's the effect you are after.

    [attachment=0:52z37bd1][/attachment:52z37bd1]

  • [quote:xm1v7cti]If you have many sounds, you can't have them all in a choose expression.

    Yes you can. Choose can have unlimited parameters.

    From the manual

    [quote:xm1v7cti]choose(a, b [, c...])

    Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two.

    Choose is a nice, easy and powerful expression.

  • Here's a quick working example. Since you have a license I've used families as it will save you having to create the "slothousingbonus" object for every "housing" object.

    [attachment=0:3ftv0yga][/attachment:3ftv0yga]

Minor's avatar

Minor

Member since 24 Jul, 2009

None one is following Minor yet!

Connect with Minor

Trophy Case

  • 15-Year Club

Progress

15/44
How to earn trophies