How to make an actor follow another actor within a rule?
Hello, guys! I hope someone can help me...
I'm making a basic pong game. My swipe area to control the paddle is at the bottom of the paddle. Now, whenever I reset the ball after a goal has been made, the ball starts just above the paddle waiting to be relaunched. My problem is, I can't make the ball follow the paddle before it gets launched. I want the player to be able to move the ball with the paddle first before launching.
Any help would be appreciated.
I'm making a basic pong game. My swipe area to control the paddle is at the bottom of the paddle. Now, whenever I reset the ball after a goal has been made, the ball starts just above the paddle waiting to be relaunched. My problem is, I can't make the ball follow the paddle before it gets launched. I want the player to be able to move the ball with the paddle first before launching.
Any help would be appreciated.
![=) =)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smiley.png)
Comments
In the paddle: constraint attribute paddleX to self.position.x
In the ball: when the ball is respawned before being launched - constrain attribute self.position.x to paddleX.
I've tried what you said but still no luck. When the ball resets, it resets to wherever the paddle is currently is in the x position and that is correct. But when I move the paddle, the ball doesn't go with it. And you are correct, I only want the ball to follow the paddle before it launches. Please help.
ps: Have you watched this video:
?
as well as this one:
?
I have seen these videos and I have no problem on how to make the ball follow the paddle. But I'm trying to make the ball follow the paddle before it gets launched... not during the game. Any thoughts?
@carlblanchet
Then you wanna have a boolean attribute, lets call it 'Playing', this attribute's default will be set to false.
In the ball and the paddle, add the constraint rules in another rule that states if Playing is false.
Now in the start button from the main menu, add when pressed changed attribute Playing to false, as well as in the restart button on the end screen and pause screen. Or instead of all this you could have in a timer in the scene after 0 seconds change attribute Playing to false, this way right when the scene is loaded it changes it to false.
Add the "Launch" button on the gameplay scene and have it off screen. When Playing is false use change attribute to change its x and y position to the desired location. Also when touch is pressed change attribute Playing is true, and change attribute to change its x and y back off screen. or you could interpolate it on and off screen, its up to you.
You will want to learn how to use multi touch in gs to be able to be touching and dragging the paddle as well as clicking the "Launch" button.
Give this a go!
Hello, carl! Okay... please be patient with me on this one.
Let's try a different approach. Right now, what I need is to make the ball visible before I press the LAUNCH button. Because right now, the ball is invisible. Everything else is fine.
Hello, Carl! You seem to be extremely helpful... I'm not sure if it's okay for me to just post my questions on other things on this thread too... but here goes...
PROBLEMS:
1. Make paddle stop when it hits the wall regardless of swiping extending beyond the touch area?
2. Control the enemy's speed at following the puck? I want to make it slower.
3. Make the ball visible in front of the actor first before launching via button?