Constraining a paddle to a shape inside the play area?
GameLabs222
Member Posts: 197
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?
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?
Answers
Hold on, let me make a quick demo . . . .
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
...
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
Thanks, now I know!
EDIT: Thought I should mention the template is no longer up, and I don't see a free section.