Minor's Forum Posts

  • 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]

  • 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.

  • Try Construct 3

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

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

  • No problem I find it's the best method for this type of movement. Phealin was having trouble recreating it from your description and I was just trying to save him the trouble, since he would have just ended with the same thing as my example.

  • Just to say when you have added my version to your game and it doesn't work. Don't have your player as a solid or it will never pass through a 32x32 gap as Construct will register a collision.

    Oh and quick note that EightBitBattleCat's way of doing roguelike movement is almost exactly as I did it in the example.

  • Not sure what the problem is but using text works so you have overlooked something.

    Did you add the instance variable as a "string" since "score1" is not a number if you use =score1 and add the instance variable as a number it won't be equal.

    A version working using "score1" as a variable.

    [attachment=0:29ykiom3][/attachment:29ykiom3]