How to make an actor move towards another actor???
QuantumGames94
Member Posts: 13
Hi can anyone tell me how to make one of my actors move towards another one of my actors, I have a paddle with a constrain attribute to the Y axis and I want it to move towards my ball which bounces off the walls of my scenene so it can hit it back to the other paddle controlled by the player, how can i make the paddle not controlled by the player move so the ball will bounce off of it??? I have no idea what i need to apply to the paddle to make this work
Best Answer
-
lukey5227 Posts: 111Make a global attribute Ball Y
In the Ball Actor
Constrain attribute Game.Ball Y to Self.position y
In the Computer Controlled Paddle Actor
Set the position X by moving it on the main screen.
Move to:
X: Starting X
Y: Game.Ball Y
Speed: Speed Here
Adjust the speed based on the difficulty. If you want it to be impossible for it to be defeated, instead of doing "Move To" you can make a Constrain attribute Self.position Y to Game.Ball Y.
Answers
I know this thread was last posted years ago, but if anyone else finds need for this answered, Here is how with the latest windows update:
The global attributes are all the variables you create in the Game Tab. When using restraints, it works best to use a "real" number variable so it can contain a float. Also, I believe there is now an option to move in the direction of an actor tag, but I am yet unsure how that works. I stumbled across this thread trying to find a way to do that, so if anyone knows about moving toward specific tags, please let me know.😊
Miss Faith 🙎
---
Hm...Does building games with Gamesalad ever get you craving Kale? Seriously! I can't stop thinking about Kale now! 🤪