helena's Forum Posts

  • TheDom

    It is ok, I have abandoned it and am going on code only now.

  • R0J0hound

    Here is my take of your examples, I combined the two different capx into one.'

    No custom plugins, yay!

    It seems to work nicely. Even in quite high speeds. Of course on my iphone 4 it is at 10-15 fps. (but it could be the every ticks-change text so nevermind for now)

    I have new questions.

    1. How do I change the angle, if I like want to nudge it 1-2 degrees? Good to have when ball is stuck in endless loop bounce in levels with intricate solid walls.

    2. If I want to make a paddle where it would change angle depending on where it is hit on the paddle itself. Or if I add round objects.

    Thanks!!

  • This person sounds like a very immature person and probably not worth to have as friend!

    What's really this person not believing? That you made the game? Tell this person about Construct 2 and that it is a great tool to make games quickly. If needed take a screenshot of a portion of your events or other project if you are cautious about your events.

  • R0J0hound

    Thank you for your help! Lots of good examples there. I will try to wrap my head around this one.

    Looks quite elegant too.

    Thanks again.

    Now off to do the evening out but tomorrow it is code time!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mattb thanks!! I will examine that one! I have another thread in the questions forum on this, haha.

  • Also I have a feeling this formula doesn't know which side the sprite is, really. hmm?

    Got suggested this post by R0J0hound I will examine the code it might be the solution.

    (at first glance I see the ball is not even having any behavior, all coded in events!)

  • granpa thanks, I edited my post, read the last paragraph... Or better yet:

    2*((angle(Sprite.x,Sprite.y,ball.x,ball.y)-ball.CustomMovement.MovingAngle)+ball.CustomMovement.MovingAngle)

    This is "closing" but not perfect, bouncing and not passing through blocks, but in wrong angle.

  • I edited the formula to replace the ball.angle to ball.custommovement.movingangle but still irregular angles. The angle result is quite high too, 389 degrees, 455 degrees, etc

    I edited the formula and until I removed the 2* in beginning and the +180 at the end the ball started to bounce and not pass through blocks, and the angle result is in more "realistic" range, but still not perfect angles.

  • granpa I used your formula like this: [attachment=0:324vpiwa][/attachment:324vpiwa]

    And the ball bounces off in strange angles, not what I would like.

    I am using this for the blocks and not the walls as I use plugin Boundary for the walls and there I could determine the direction thanks to the top, bottom, left, right side.

  • ZeroBelow I have that project, it was one of the first tutorials I followed. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    R0J0hound I tried as you suggested, push out of solid action, and I thought it would be a good solution. But the ball will just pass through if I choose "opposite direction". When choosing "near" it will go "around" the block in funny way, so at least that one is working.

    If you could figure out the formula I would be very happy.

    To everyone, here I have made another project, but not in CAPX because of your not wanting to download plugin. Tekniko

    http://www.funnybunny.se/files/ballexamples/

    Four examples of different types.

    Look at how the classic bullet would go off in strange angles when sped up or after a while.

    and the classic config of solid walls and bullet would escape at max speed (on my computer at least) but this problem won't happen with the Boundary plugin.

    I hope you will understand what I mean with keeping proper angles AND minimizing risk of escapey ball.

    I know thicker walls = better chance to keep in the ball.

  • Tekniko

    it is ok, you do not have to help me.

    Which movement did you use, if you remember? Bullet?

    Many projects with breakout style games made with C2, including the ones in tutorials and examples (and my own older projects on break out style games), have this problem with bouncing off in unpredicted way once in a while if they use bullet behavior plus collision with solids - Bounce off Object. (for example going into 45 degrees and then suddenly bounce off in like 23 degrees and not -45)

    Boundary plugin is a nice way to keep the ball within the play area without writing too much events.

    But I am open to debate of course, I want to perfect the ricochet process.

    This is just experiment with goal to see if it can be polished into max.

  • I wanted to make a more reliable breakout style game or just ball/ricochet that would bounce off in proper angles and not fly off randomly. (all in the style of 70-early 80s era game) Also not escaping the play field.

    For the not escaping play field I used rexrainbow plugin Boundary which works nicely.

    For the better, more predictable moving of the ball/bullets I used custom movements instead for bullet. It is so much better!! (the "Reverse custom movement" for example to switch the angle)

    The goal is indeed to have a good code even for high speed or low spec computers.

    Here's a capx just be aware you have to have Boundary plugin.

    Use shift to add ball, you can add more balls. The paddle's top will change the ball's angle.

    Left/right arrow to move the paddle.

    Spacebar to pause game, enter to unpause.

    Try add 10+ balls in this game and study how the balls starts to go through the blocks.

    (wait with the first ball until you got the screen filled with at least 100+ blocks)

  • With big offset it looks like the ball is bouncing mid air. So I l lowered to 2 px offsets only. It works in slow but when on low spec or high speed it would be less exact. hmm.

  • Hello.

    On collision with a sprite, how do I figure out which side of the sprite another sprite (ball) is colliding with?

    For example if the ball is hitting the bottom edge of a sprite. Or its left..

    Should work with sprites that are generated dynamically and not slow down with hundreds of sprites on layout.

    I am open to plugins if it shorten down the coding.

    Something like rexrainbow 's Boundary but externally and not clamping/wrapping.

  • Nevermind, it is not sound coding once I added more varied angles from a paddle... the blocks bounce off code is NOT good at all, lol. >_<; I wish I had more talent for math!!