Vallar's Recent Forum Activity

  • Hi,

    I am trying to make a game with elements of break out and I am stuck with a few behaviors I am unsure how to solve:

    1- In my game sometimes the ball reaches high speeds over time, when that happens the ball sometimes ignores collisions, how can I make sure the ball doesn't do that? Note the high speeds don't exceed 2300 for example.

    2- How can I change the direction of the bounce depending on the collision location between the paddle and the ball? I tried doing Set Angle of Motion to "Ball.X - Paddle.X / Paddle.Width" and it didn't quite work at all. Any idea how to make it that the left third of the paddle sends the ball slightly to the left, the right third of the paddle sends the ball slightly to the right and the middle third of the paddle deflects the ball 90 degrees?

    What I opted to do is just add a slope to the collision from both left and right directions but somehow it feels as if it is a hack.

    3- One last question but may seem random (but it isn't), I am trying to use a bullet behavior on an object that acts as a projectile. When that projectile gets a target (let's say a prick), I set its angle of motion to (projectile.x, projectile.y, target.x, target.y) and have the Bullet Behavior property speed set to 400 (no change of angle as angle of motion). But the projectile doesn't rotate to face its target. I tried to use Rotate towards Position and it isn't working, any other solution for this?

    Any help would be appreciated and thanks in advance.

  • I think what he is trying to do is the following:

    Have a sprite instance with flag 1 and all other instances with flag 0. When flag1 sprite collides with flag0 sprites, flag0 sprites should have a set opacity to 25.

    Meanwhile, it has to be the same exact object not a clone of it and you need to only set the opacity to the sprites that are colliding not the ones that aren't colliding with flag1 sprite.

  • I think it is more a limitation of my knowledge than Construct 2 itself. I would suggest waiting till someone else notices the thread and tries to help.

  • I don't think it is too hard, no. But I couldn't understand what you need and the CAPX wasn't really enough. After all I am only trying to help.

    Here is a method to do this:

    goo.gl/c0u2gy

    I cloned the same object and only changed the flag and its name. So they are 2 objects now (Flag0 and Flag1) but both look the same. Now you can just do a collision check and from that check you can do whatever action you want.

    If you don't like this method, I suggest you wait for someone else's answer. Good luck!

  • For some reason I read before somewhere that using the Physics was better than the bullet behavior. If it is better to use the bullet behavior then I could switch over to that.

    But two other problems arise:

    1- With high speeds, the ball sometimes just ignores all collisions and goes through solids, anyway to counter this?

    2- How can I change the direction of the bounce depending on the collision location between the paddle and the ball? I tried doing Set Angle of Motion to "Ball.X - Paddle.X / Paddle.Width" and it didn't quite work at all. Any idea how to make it that the left third of the paddle sends the ball slightly to the left, the right third of the paddle sends the ball slightly to the right and the middle third of the paddle deflects the ball 90 degrees?

    3- One last question but may seem random (but it isn't), I am trying to use a bullet behavior on an object that acts as a projectile. When that projectile gets a target (let's say a prick), I set its angle of motion to (projectile.x, projectile.y, target.x, target.y) and have the Bullet Behavior property speed set to 400 (no change of angle as angle of motion). But the projectile doesn't rotate to face its target. I tried to use Rotate towards Position and it isn't working, any other solution for this?

    Thank you very much for your time and efforts!

  • A pick with evaluation action should do the trick.

    Try the Capx I have linked below:

    goo.gl/LPOZNq

    EDIT: Fixed URL

  • I think your actions need to change. Remove the "For Each" and have it like that:

    On Collision with Sprite:

    ----> Compare flag = 0 ::::> Set opacity to 50

  • I am trying to understand exactly what you are trying to do and I am not sure I fully understand it.

    So here is a little CAPX that might help with collision detection based on an instance variable.

    goo.gl/NIVfz9

    There is a space added because the forums removes the URL

    If that doesn't help, let me know. Good luck! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

  • Bump, still looking for a proper method to do a breakout clone using physics.

    What I have so far is that the ball has physics with elasticity set to 1 and all other options set to 0; Immovable is No, Collision is Circle and Prevent Location is set to No. The Bullet Physics is set to enabled too.

    Unfortunately I can't seem to control the ball with the paddle at all. The bounce is always on a 45 degrees angle. The "hacky" way I did is make the paddle's collision have an angle rather than being a straight line. But it still feels weird and off.

    Also when the ball hits a vertical wall on its way upwards, it sometimes instead of deflecting to an angle upwards, it bounces off with an angle towards the paddle (even though it was on its way up to the upper wall).

    The walls have all settings to 0 except Elasticity to 1 and immovable to Yes.

    Any ideas how to resolve these issues please? Any help would be appreciated.

  • In that case do two conditions:

    -----> Compare Variable Flag = 0

    AND (right click on the slot above and select "Add Another Condition").

    ------> Compare Variable Flag = 1

    Now you can compare the flags as you wish.

  • I can't at the moment test my theory, but if I recall correctly, you can use one of the below solutions:

    On Collision with Object X

    ----> For Each

    -------- > Compare Variable Flag = 0

    Do actions.

    That or instead of using "For Each" you can use Pick All Comparison and add in an expression: object.flag and equal to 0 or 1.

    Hope that helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, I see. Shame! I am supervising a few grade 7 students and they wanted to make an app that teaches blind kids math, science, English, etc...

    Touching or taping the screen isn't as ideal or as effective as a physical button. They'll have to find another way .

    Thanks a lot for your assistance guys

Vallar's avatar

Vallar

Member since 24 Mar, 2014

None one is following Vallar yet!

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies