Are custom collisions possible?

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
I'm making a brick breaker/breakout type game and I'd like to have my player paddle collisions a little different. It seems that the collision effects in GS are not working the way that I'd like. (I'm sure many of you have played Brick breaker) so I'd like for the paddle to have more of a straight up/down collision in the middle of the paddle, but on the outsides of the paddle I'd like it to be more ... (is oblique the word?) (I'm sure many of you have played Brick breaker and know what I mean).

So would I have to create a rule to create this effect? Or would I have to do some super fancy coding? Also, I want the left of the paddle to bounce the ball to the left and the right of the paddle to bounce the ball to the right, but it ultimately depends on how the balls are moving (should I create 2 paddles and put them together?)

Thanks!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    One way to do this is have the image of your paddle you want and setup a few small transparent blocks to be constrained to the paddle image in the positions you want to create the collision shape you are looking for. depending on whats going on you should be fine with those constrains not being to much for the game to handle.

    ___________________________________________________________________________________
    BubbleBall Template HERE!!

    AppSolute Entertainment on Facebook
  • DrGlickertDrGlickert Member Posts: 1,135
    Hmm, would this work?

    If I create an object that has a circular collision pattern (at say like a 200x200 size) I think that would work. But if my image is only like 80x20 is that possible??
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Sure but its going to be coliding with a big empty space because GS collides based on the image size so two things will happen.

    First you put a 80x20 image into a 200x200 actor and GS will stretch the image to 200x200 and look horrible.

    Or you make a 200x200 transparent image and place you 80x20 image in that but the ball will bounce at the transparent edge.

    now you can do a 80x20 actor that has circle collisions. and that will give you an arch shape to the entire top of your paddle. You wont have any flat places on the paddle but it might give you the effect you are wanting.

    ___________________________________________________________________________________
    BubbleBall Template HERE!!

    AppSolute Entertainment on Facebook
  • DrGlickertDrGlickert Member Posts: 1,135
    I can't do an 80x20 actor in a circle, because GS only allows the "collision in the shape of a circle" to be the largest circle that can be created in the objects size (so in this case, it would be a circle that's 20x20). The outside of the rectangle do not register as part of the collidable area and the balls fly right through it...

    This is getting frustrating. Collisions in GS are pretty choppy I'm finding.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    This is how i do it. Have 2 attributes paddle x and paddle y. In the paddle constrain paddle x to self position x, and paddle y to self position y. Then make a new actor, around the size of the paddle, change its alpha to 0, constain its x position to paddle x, and its self position to paddle y. Have it a circle collosion shape, and have all your collide rules on that invisible actor, not on the actual image. Since its a circle collosion shape with no image, by playing around with its size you can adjust its collosion area to be the exact size of the paddle, without no missing corners or anything. and since its position is constrain to the paddle attributes, it will always be where the paddle is.
  • DrGlickertDrGlickert Member Posts: 1,135
    Thanks John! I'll give that a shot and see if it works! Is that how you did your game, Saucer 44?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    DrGlickert said:
    Thanks John! I'll give that a shot and see if it works! Is that how you did your game, Saucer 44?

    Anytime, and yeps thats how we did it. If you play around with the invisible actors size, youll get the collision perfect. I would start by having it the same size as the paddle actor, and then do your adjustments from there on.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    DrGlickert said:
    I can't do an 80x20 actor in a circle, because GS only allows the "collision in the shape of a circle" to be the largest circle that can be created in the objects size (so in this case, it would be a circle that's 20x20). The outside of the rectangle do not register as part of the collidable area and the balls fly right through it...

    This is getting frustrating. Collisions in GS are pretty choppy I'm finding.

    Hmm I never knew that about circle collisions I always assumed it just did a circular shape based on the actor size. That is pretty crapy on the collisions then. :(
  • DrGlickertDrGlickert Member Posts: 1,135
    tenrdrmer said:
    Hmm I never knew that about circle collisions I always assumed it just did a circular shape based on the actor size. That is pretty crapy on the collisions then. :(

    I know, right?!

    But, as much I want to complain about it, this is a free app maker AND, they did give me a free Pro license for doing the Global Game Jam. So I'm not completely upset about that...
  • DrGlickertDrGlickert Member Posts: 1,135
    Hmm, collisions still have some slight issues, but it's better. Sometimes it'll hit the left side of the paddle and will bounce off to the right... (and vice versa).

    Any ideas?
  • Rob2Rob2 Member Posts: 2,402
    Have a look at the Crazy Ball Wall Breaker (!) template, that accounts for where on the paddle the ball collision takes place and then puts in some corresponding horizontal vector.
  • DrGlickertDrGlickert Member Posts: 1,135
    I'm not exactly sure this will help Rob. I'm not using the mouse to control the paddle, I'm using the Left/Right keys or A/D keys (on the iPhone/iPad I'll use two arrows on the sides). Any idea what I should be put in place of the "game.Mouse.Position.X" portion of the code?

    Thanks
Sign In or Register to comment.