I don't think it is possible using this method because you are constraining the paddle to the ball so it will always follow the ball. Not sure how to make the computer "beatable", but I image you could use accelerate towards instead of constrain. Then if the speed of acceleration is set to a random range you should be able to get the paddle to accelerate fast enough some of the time and not fast enough some of time thus making it beatable.
For future reference and probably speaking for the forum mods (if there are any), it probably would be best not to start up new threads regarding the same subject, as it would flood the forums.
It would make the Computer Paddle move in normal speed and in the direction based on whether or not the Y values were higher or lower. I knew Constraining the Attribute would make the Computer Paddle move unrealistically, and would never miss the ball, so I never gave him that setup.
I would create a game attribute (integer) called ballX. In the ball constrain game.ballX to self.positionX
In the computer paddle. Use accelerate towards and for the X put in game.ballX. For the speed set it to random(lowest speed, highest speed) then set the Max speed in the attributes pane so that it cannot go insanely fast. you can also use the drag behavior to control how it fast it comes to a stop or starts up. Setting the max speed should do the trick.
Thanks scitunes! worked like a charm! only one more problem Sometimes the ball will collide with the paddle and sometimes is goes right thru. Any ideas? And this is with the player paddle.
Are you constraining the paddle to touch? I have found that objects that are constrained have less than perfect collision detection. I had been working on a doodle jump style game and gave up for that reason. All of my rules were right but sometimes it would land on a moving platform and just stand there for a while instead of jumping.
I have a game (kidney bounce - I know. horrible name!) that has a paddle style control system and I use the accelerometer and have never had a problem with collision. I was thinking of giving people the choice of using touch, but now 'm thinking it may not work consistently enough.
are you using touch to control the player paddle? Any tips for doing that that I can use on my kidney bounce science game? Did you just constrain the x position to touch?
Comments
For future reference and probably speaking for the forum mods (if there are any), it probably would be best not to start up new threads regarding the same subject, as it would flood the forums.
It would make the Computer Paddle move in normal speed and in the direction based on whether or not the Y values were higher or lower. I knew Constraining the Attribute would make the Computer Paddle move unrealistically, and would never miss the ball, so I never gave him that setup.
In the computer paddle. Use accelerate towards and for the X put in game.ballX. For the speed set it to random(lowest speed, highest speed) then set the Max speed in the attributes pane so that it cannot go insanely fast. you can also use the drag behavior to control how it fast it comes to a stop or starts up. Setting the max speed should do the trick.
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io