Wednesday 15 September 2010

ios - Draw a hypothetical line in swift -


So in my game this is a paddle and a ball, and I want to calculate the side of that pedal that the ball Hit, I got this answer in C #, which shows two rows in this way:

Point of contact

So what I want to do attracts two fictional lines (which is invisible to the user), so I can calculate that the ball is greater or two Held on or if one of the sides in contact with a paddle.

How do I get these lines in phantom kit and sharpness?

UPDATE

I got the basic answer, its

You can check the position of the ball in relation to the pedal.

  If (ballNode.position.x> paddleNode.position.x) {// the ball is on the right side of the pedal} and {// the ball is to the left of the pedal} if (ballNode .position.y & gt; Paddle node .position.y) {// ball is above pedal} and {// ball below pedal}  

No comments:

Post a Comment