If I'm understanding you correctly, you want to want the computer to have some artificial intelligence for his paddle to follow the ball.
It's fairly easy, since the only movement the computer can make is up or down.
Create Game Attribute BallY. In the Ball Actor, Constrain Attribute BallY to be equal to the Ball's Position Y. In Actor ComputerPaddle: Make a timer that, for every 1 second, Rule: if ComputerPaddle.Position.Y > BallY, go down, Otherwise, go up.
You can also add some randomness or increase the counter time to it so create a beginner computer level or that it would appear slower to respond, like a beginner player would.
When using the Expression Editor, you can't type the Attributes in. You need to select it from the drop down (click the white downward facing triangle button) and select it from the list.
"Go Down" means move the Actor by adjusting the Y coordinates. ComputerPaddle.Position.Y = ComputerPaddle.Position.Y - 5
"Go Up" is ComputerPaddle.Position.Y = ComputerPaddly.Position.Y + 5
Did you happen to look at any of the video tutorials? Have you downloaded any of the sample projects and other people's games? Go to one of the games playable on GameSalad.com. You can right-click on the "Download Project" and save the .game file to your hard drive. Then, rename it to .zip and you can open it and load the game into GameSalad. It may be a good opportunity to peek in at other people's work to see how things are done.
You should watch some of TShirtBooth's video tutorials. They will help you get going with the basics. At the top of the website, click Profiles, and click on his profile. He has all sorts of great tutorials, demos, and examples of what can be done with GameSalad.
Comments
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
It's fairly easy, since the only movement the computer can make is up or down.
Create Game Attribute BallY.
In the Ball Actor, Constrain Attribute BallY to be equal to the Ball's Position Y.
In Actor ComputerPaddle:
Make a timer that, for every 1 second,
Rule: if ComputerPaddle.Position.Y > BallY, go down, Otherwise, go up.
You can also add some randomness or increase the counter time to it so create a beginner computer level or that it would appear slower to respond, like a beginner player would.
Hope that helps.
Do you already have all the Actors in place in your Scene? Yours, the ball, and the Computer Paddle? Is the ball moving and bouncing properly?
So, under Game, go to Attributes, and create an Attribute. Make it an integer and call it "BallY."
Then, go back into the Ball Actor and add a Constrain Attribute Action, making Game.BallY to be equal to Ball.Position.Y.
Then, go back into the Computer Paddle Actor and create the Behaviors as listed above.
ComputerPaddle.Position.Y = ComputerPaddle.Position.Y - 5
"Go Up" is ComputerPaddle.Position.Y = ComputerPaddly.Position.Y + 5
Did you happen to look at any of the video tutorials?
Have you downloaded any of the sample projects and other people's games?
Go to one of the games playable on GameSalad.com.
You can right-click on the "Download Project" and save the .game file to your hard drive.
Then, rename it to .zip and you can open it and load the game into GameSalad.
It may be a good opportunity to peek in at other people's work to see how things are done.