Constrain mouse.self.position.x.y to lightsaber.self.position.x.y
Constrain self.rotation to vectorToAngle(self.Motion.LinearVelocity.X,self.Motion.LinearVelocity.Y)
That should do it - easy peasy lemon squeezy
Thanks, and I'm thinking you could set random attributes for these rules if you want a computer opponent?
Well its not that simple - You're talking about creating AI. Doing the actual swinging is easy - but creating a AI very difficult
There are some factors you need to concider.
1. Distance from you lightsaber to the AI lightsaber = use magnitude monitor distance 2. Then if distance is < Constrain self.rotation to vectorToAngle(self.Motion.LinearVelocity.X,self.Motion.LinearVelocity.Y*(swing speed) just a VERY simple example.
But building Intelligence is thinking through and number of scenarios and then create rules the simulate them.
Attack, defend, idle, etc, etc. Then one i just described would be attacking in a very simple format.
Ok, and I followed your advice on how to make it "swing" and it moves left, right, up, down, but has no angular or swinging motion whatsoever. Why is this?
I know it is a little late to continue asking questions on how to do this, but after trying to do what was done in the video above, the actor still does not rotate at all. It just follows the x,y position of my mouse wherever I move it, but does not swing like a sword. Any help on how to extrapolate the info in the videos to follow my mouse, not another actor?
I have a rule under the sword actor that says every 0 seconds (not to completion), change attribute self.rotate to VectorToAngle(game.mouse.positionX-self.position.X, game.mouse.position.Y-self.Position.Y). What am I doing wrong? Specific rules would be greatly appreciated.
I've tried everything-all the videos and followed peoples' advice. But my actor only moves side to side and up and down, and doesn't rotate or exhibit a swinging motion like the lightsaber in the game. Please help with specific attributes and rules if possible. Thanks ahead of time
Comments
- Thomas
http://img.photobucket.com/albums/v325/Tealin/spongebob-imagination.jpg
Constrain self.rotation to
vectorToAngle(self.Motion.LinearVelocity.X,self.Motion.LinearVelocity.Y)
That should do it - easy peasy lemon squeezy
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Doing the actual swinging is easy - but creating a AI very difficult
There are some factors you need to concider.
1. Distance from you lightsaber to the AI lightsaber = use magnitude monitor distance
2. Then if distance is < Constrain self.rotation to
vectorToAngle(self.Motion.LinearVelocity.X,self.Motion.LinearVelocity.Y*(swing speed)
just a VERY simple example.
But building Intelligence is thinking through and number of scenarios and then create rules the simulate them.
Attack, defend, idle, etc, etc.
Then one i just described would be attacking in a very simple format.
here's another thread about how to make an actor follow another actor
http://forums.gamesalad.com/discussion/comment/374967/#Comment_374967
every 0 seconds (not to completion), change attribute self.rotate to VectorToAngle(game.mouse.positionX-self.position.X, game.mouse.position.Y-self.Position.Y). What am I doing wrong? Specific rules would be greatly appreciated.
I've tried everything-all the videos and followed peoples' advice. But my actor only moves side to side and up and down, and doesn't rotate or exhibit a swinging motion like the lightsaber in the game. Please help with specific attributes and rules if possible. Thanks ahead of time
@lycettebros -- Glad you like it. With GameSalad its fun to figure out things like this.