Paddle "game.mouse.position.X" problem!!!

1UpGamestudio1UpGamestudio Member Posts: 213
edited November -1 in Working with GS (Mac)
Hi, I would like to ask you a question.
I would create a pong style game with two players, to move the paddle I used the command: max ((10 + (self.Size.Width / 2)), min ((310 - (self.Size.Width / 2)) , game.Mouse.Position.X))
The problem with using this command is that when I apply it to the second paddle touching the screen with two fingers, the paddle does not move. game.Mouse.Positio probably because it conflicts with the first paddle.
Can someone give me a solution?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    use touch1 position x and touch 2 position x
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    Thanks john but i have try this method but touch1 work and touch2 don't work
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    sorry i couldnt be of more help :(

    hopefully someone else will chime in soon, if not when im done with dinner ill mess around with it for you
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Try this out--

    In paddle One put:
    Rule
    -- When game.Touches.Touch 1.X < 240
    ---- Constrain Attribute: self.Position.Y To: game.Touches.Touch 1.Y
    --Otherwise:
    ---- Constrain Attribute: self.Position.Y To: game.Touches.Touch 2.Y

    Then in paddle Two put:
    Rule
    -- When game.Touches.Touch 1.X > 240
    ---- Constrain Attribute: self.Position.Y To: game.Touches.Touch 1.Y
    --Otherwise:
    ---- Constrain Attribute: self.Position.Y To: game.Touches.Touch 2.Y

    Hope this helps!
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    Hi RThurman, i see your response to my question about paddle.
    Please you may send me an example of how to do? I did not understand very well!!!
    my email is 1upgamestudio2010@gmail.com
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    OK -- here is a copy of the GameSalad demo that has been modified to play on an ios device. It uses touches instead of keyboard input. Look in the paddle actors to see touch implemented.
    http://speedy.sh/k2atv/twoFingeredPong.zip

    Hope this helps.
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    Thanks
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You are welcome!

    Is it what you were looking for?

    RThurman
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    RThurman,
    it would be just fine for what I do.
    I can make another request? My pong is played with the screen vertically, how do I move the ball bounces properly taking into account that when the paddle has a different angle depending on where it touches on paddle?
    For example breakout game!!!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    1UpGamestudio said:
    My pong is played with the screen vertically, how do I move the ball bounces properly taking into account that when the paddle has a different angle depending on where it touches on paddle?
    For example breakout game!!!

    I'm a little confused.
    Are you asking how to make the game play vertically?
    Are you asking how to place both paddles on the 'bottom" (like breakout has a paddle on the bottom)?
    Are you asking how to give the ball some forward spin and backward spin, based upon where it hits the paddle?
    Are you asking how to give the ball spin based upon the paddle's speed (like the old breakout games).

    I think you are really asking about the fourth question. But you are thinking in terms of the third question.

    Maybe I'm wrong -- or my memory of the good old days is faulty, but I think the older versions of the breakout game gave backspin based upon paddle speed, not distance from the center of the paddle. (But either way, I hope these two hints help.)
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    if you look at the tutorial gamesalad "crazy ball wall breaker" Note that when the ball bounces off the paddle, depending on where it touches the angle changes and the same thing on the walls. I would like to recreate the same thing with the screen protrait.
    Can you tell me how?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    1UpGamestudio said:
    if you look at the tutorial gamesalad "crazy ball wall breaker" Note that when the ball bounces off the paddle, depending on where it touches the angle changes and the same thing on the walls. I would like to recreate the same thing with the screen protrait.
    Can you tell me how?

    To change that game from landscape to portrait, use Y instead of X.
    In the Ball actor, under the "Note" there is a Change Attribute behavior. Modify it to:

    Change Attribute: Motion.Linear Velocity.Y To:self.Motion.Linear Velocity.Y +2*( self.Position.Y - game.Mouse.Position.Y )
Sign In or Register to comment.