Constraining a paddle to a shape inside the play area?

GameLabs222GameLabs222 Member Posts: 197
edited April 2013 in Working with GS (Mac)
So I have a game that uses a paddle to hit a ball. The paddle is controlled by touch. The stage I've made with graphics is smaller than the screen and has rounded corners. It is not a box.

I understand how to constrain a paddle inside the viewable screen so it doesn't go off the side and disappear. However, I need to constrain it to a rounded rectangular shape. I could get it to hit the straight parts of the stage fine, but once it gets to the rounded corners of the stage the paddle crosses over some of the corner because the constrained area is a square and the stage is not.

I need the paddle to hit the edge of the walls of the stage, even at curved areas and not go any further, even if the player touches outside the edge of the stage.

Is this possible? Can you constrain user input to arbitrary shapes in GameSalad?

Best Answer

Answers

  • SocksSocks London, UK.Member Posts: 12,822
    I'd just plot out your rounded corners as collision points, depending on on the size of the actor you want to interact with these rounded corners the collision points needn't be joined up, they can often be fairly widely spaced.

    Hold on, let me make a quick demo . . . .
  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2013
    Here you go:

    V1: http://www.mediafire.com/?bnho5bu7xaldiau

    Here is the same thing with the collision points even more spaced out, hopefully you can see that you don't really need them to be that close for a curved collision surface - obviously in the actual game all these collision actors would be invisible - and your graphics with nice smooth corners would sit over the top:

    V2: http://www.mediafire.com/?ebhl0dbh477waxi


    ...
  • GameLabs222GameLabs222 Member Posts: 197
    edited April 2013
    Thanks for the help thus far, but I should have been less vague. My game is Air Hockey. I'm new to GameSalad and I figured Air Hockey would be a great point to start at for learning.

    I still need to be able to keep the users input (touch) that will control a paddle from moving the paddle outside the same area that the balls are in. I can design the stage to be more square like but I'm going for more of an Ice Hockey rink with the graphics so the corners are rounder.

    I've added a paddle.
    http://www.mediafire.com/?o341570zchl14db

  • GameLabs222GameLabs222 Member Posts: 197
    edited April 2013
    I was actually just thinking I could maybe have it follow and just speed it up to seem constrained.

    Thanks, now I know!

    EDIT: Thought I should mention the template is no longer up, and I don't see a free section.
  • SocksSocks London, UK.Member Posts: 12,822
    I was actually just thinking I could maybe have it follow and just speed it up to seem constrained.
    Follow = constrained.
    EDIT: Thought I should mention the template is no longer up, and I don't see a free section.
    Maybe email GSHelp, they are a friendly bunch, I'm sure they might have it somewhere.
Sign In or Register to comment.