I'm done with thanksgiving and back to work on the project.
I tried what you last suggested and got some very odd things happening. It seems the only thing that it changes is that the paddle stays behing farther on the left. In other words, when you have your mouse in the bottom right, the paddle is rotated 90 degrees and it works fine. But as you start to move to the left, the paddle remains behind more. By the time you get to the left, the paddle is only rotated 45 degrees to the left instead of 90. This is very odd. I tried playing around with the number, but it only seemed to make it worse. Keep in mind, I don't meen that the paddle is accelerating slower when you get to the left side, I just mean that it can't get to the left side. Also, when you drag below the screen, the paddle flips out and turns in wild circles for a moment. I've checked oer hat i've done about a million times. Any suggestions?
No that isn't quite the behavior it should be displaying. The paddle should track toward the mouse (when the mouse is down). It should start fairly quickly, then slow down as its reaches the correct angle. It you move the mouse (while mouse is still down) the paddle should continue to track like you want it to.
I have two guesses why it is not working; 1) the equation has an error somewhere 2) its not the only behavior in the mousedown rule Make sure that some other behavior is not interfering with it somehow. Perhaps there is something left over from another version that is interfering with it.
Wow -- this little routine has gone through a lot of iterations!
I think you want to keep 1, 2, and 3. You want to disable or get rid of 4, 5, and 7. It looks like 6 is the closest to what you need. It should look like this (within a the mousedown rule):
when mouse is down -- Constrain Attribute: self.targetAngle To: self.targetAngle + (vectorToAngle(game.Mouse.Position.X - game.BlockX , game.Mouse.Position.Y - game.BlockY ) - self.targetAngle)*.1
Notice that #6 (in your version) is missing the first "self.targatAngle +" and the last "- self.targetAngle". They are quite necessary. (That would be why it was giving strange results yesterday.)
Also make sure that the parentheses are there, and in the right place. The equation should have two opening ones as well as two closing parentheses.
Hey, I've been offline for a few weeks. Any ideas on how to make it so that my paddle doean't go past the bottom of the screen? I tried using min and max (TSB Tutorial) but I couldn't get it with the arc. Thanks.
OK -- but before I answer, its important to note that this one constrain behavior is actually doing about 4 separate functions. Its only become a huge equation because different criteria have been added to it. Here goes:
When mouse is down: ---- Constrain Attribute: game.mouseangle To: min(180,max(0,game.mouseangle+ ((((vectorToAngle( game.Mouse.Position.X-game.blockX, game.Mouse.Position.Y-game.blockY)-game.mouseangle)+180)%360)-180)*.1))
The "+180)%360)-180)" stuff is to account for the weird flipping that happens when the angle changes from a positive number to a negative.
Hey, I put that in there without getting rid of any of the other rules. However, it doesn't do anything at all. I realized that game.mouseangle is not actually used in any of the rules I have except the one you just gave me. So should I replace targetangle with mouseangle? I'm kind of confused. Right now I have the same things as before but with this new one added. No effect.
Also, I have another level that is like this, but not it an arc. I need the addle to do th same thing, but jsut move across the x axis toward the touch.position.x right now i have just an accelerate toward. But it looks different than the way you gave me. I want to change the flat so it moves in the same way. I assume this woud be a lot easier since you don't have to worry about it moving in a arc and the rotation and everything, but not sure quite what to do.
Also, I have another level that is like this, but not it an arc. I need the addle to do th same thing, but jsut move across the x axis toward the touch.position.x right now i have just an accelerate toward. But it looks different than the way you gave me. I want to change the flat so it moves in the same way. I assume this woud be a lot easier since you don't have to worry about it moving in a arc and the rotation and everything, but not sure quite what to do.
Sorry to ask so much of you. Hoever, how would I go about making it so that this movement can be controlled my two keys (A and D) I need this for testing, since my mouse has to be somewhere else. If not, no big deal
Sorry for the delay. I've only had about a 45 minute window for GameSalad in the last four days.
SnapFire said: "I put that in there without getting rid of any of the other rules. However, it doesn't do anything at all. I realized that game.mouseangle is not actually used in any of the rules I have except the one you just gave me. So should I replace targetangle with mouseangle? I'm kind of confused. Right now I have the same things as before but with this new one added. No effect."
I meant that you should modify the existing constrain behavior's equation. You need to add all the other stuff into the existing equation. Also, you should use self.targetAngle. (In a previous example that you posted on 29 November you used game.mouseangle -- so I was trying to match what I thought you were using. But if you are using self.targetAngle then yes, the equation should have that instead.)
@SnapFiresaid: Also, I have another level that is like this, but not it an arc. I need the addle to do th same thing, but jsut move across the x axis toward the touch.position.x right now i have just an accelerate toward. But it looks different than the way you gave me. I want to change the flat so it moves in the same way. I assume this woud be a lot easier since you don't have to worry about it moving in a arc and the rotation and everything, but not sure quite what to do.
Right -- it is much easier. To get the paddle to move to the mouse's X location -- the behavior would be:
When mouse is down: ---- Constrain Attribute: self.Position.X To: self.Position.X + (self.Position.X - mouse.Position.X)*.1
To get it to have the same 'feel' as the semicircle movement you need to have the same "gain factor" in both equations. That is, the number you use where the ".1" is, needs to be the same for both the semicirclar motion and the linear motion equations.
One more thing - as usual - I need to get this to work with accelrometer.
I'm planning on having a separate actor that moves to the left and right with the accelerometer, then put that actor's X Position in instead of the MousePosition.X
I assume that will work. I'm trying the flat version now. Thanks once more for all your help. -Thomas
Got the accelerometer. How would I make it so that when you touch part of the screen, nothing happens to the paddle? I need to have a part where you can touch without it affecting the paddle. Any Ideas?
This feels like a different question than 'moving an actor in a semicircular motion while facing outwards'. Time for a new thread?
I would say generally that you would need to use touch, rather than mouse down. Also you would need to have an actor that detects the touch and sets a (game) Boolean attribute to true. The actor would need to be big enough to cover all the 'touchable' area.
Then, while the Boolean attribute is true, detect the touch position and move the paddle accordingly.
I made an actor for the touchable area, but now nothing works. I put in the Boolean Atribute like you said.
Now nothing works; won't move at all. Any ideas? I swear it's nothing on my part.
Also, I did what you said fr accelerometer, and it doesn't move smoothly like it does with the touch. It just moves in a defined patter, never slowing down or speeding up. ???
Comments
-Thomas
I'm done with thanksgiving and back to work on the project.
I tried what you last suggested and got some very odd things happening. It seems the only thing that it changes is that the paddle stays behing farther on the left. In other words, when you have your mouse in the bottom right, the paddle is rotated 90 degrees and it works fine. But as you start to move to the left, the paddle remains behind more. By the time you get to the left, the paddle is only rotated 45 degrees to the left instead of 90. This is very odd. I tried playing around with the number, but it only seemed to make it worse. Keep in mind, I don't meen that the paddle is accelerating slower when you get to the left side, I just mean that it can't get to the left side. Also, when you drag below the screen, the paddle flips out and turns in wild circles for a moment. I've checked oer hat i've done about a million times. Any suggestions?
-Thomas
I have two guesses why it is not working;
1) the equation has an error somewhere
2) its not the only behavior in the mousedown rule Make sure that some other behavior is not interfering with it somehow. Perhaps there is something left over from another version that is interfering with it.
Hope that helps!
I don't quite understand which rules I should keep and which ones to get rid of.
Right now this is what I have:
1) Constrain Atribute: self.position.x To: 100*cos( self.targetAngle )+ game.BlockX
2) Constrain Atribute: self.position.y To: 100*sin( self.targetAngle )+ game.BlockY
3) Constrain Atribute: self.rotation To: vectorToAngle( self.Position.X - game.BlockX , self.Position.Y - game.BlockY )-90
4, 5, 6, and 7 are withen Rule: When mouse button is down:
4: Constrain Atribute: game.mouseangle To: vectorToAngle( game.Mouse.Position.X - game.BlockX , game.Mouse.Position.Y - game.BlockY )
5: Change Atribute: game.mouseangle To: vectorToAngle( game.Mouse.Position.X - game.BlockX , game.Mouse.Position.Y - game.BlockY )
6: Constrain Atribute: game.mouseangle To: vectorToAngle( game.Mouse.Position.X - game.BlockX , game.Mouse.Position.Y - game.BlockY )*.1
7: Interpolate: self.targetangle To: game.mouseAngle Block (Dur. 1 - Function. Ease In)
Please let me know which ones should be on and which should be off.
Thanks,
Thomas
I think you want to keep 1, 2, and 3. You want to disable or get rid of 4, 5, and 7. It looks like 6 is the closest to what you need. It should look like this (within a the mousedown rule):
when mouse is down
-- Constrain Attribute: self.targetAngle To: self.targetAngle + (vectorToAngle(game.Mouse.Position.X - game.BlockX , game.Mouse.Position.Y - game.BlockY ) - self.targetAngle)*.1
Notice that #6 (in your version) is missing the first "self.targatAngle +" and the last "- self.targetAngle". They are quite necessary. (That would be why it was giving strange results yesterday.)
Also make sure that the parentheses are there, and in the right place. The equation should have two opening ones as well as two closing parentheses.
Hope this helps!
You're a freaking boss.
Everything works.
!!!
Thank you,
-Thomas
GameSalad is a pretty awesome development tool. All that power of creation just waiting to be discovered!
RThurman
When mouse is down:
---- Constrain Attribute: game.mouseangle To: min(180,max(0,game.mouseangle+ ((((vectorToAngle( game.Mouse.Position.X-game.blockX, game.Mouse.Position.Y-game.blockY)-game.mouseangle)+180)%360)-180)*.1))
The "+180)%360)-180)" stuff is to account for the weird flipping that happens when the angle changes from a positive number to a negative.
Hope this helps!
RThurman
I put that in there without getting rid of any of the other rules. However, it doesn't do anything at all. I realized that game.mouseangle is not actually used in any of the rules I have except the one you just gave me. So should I replace targetangle with mouseangle? I'm kind of confused. Right now I have the same things as before but with this new one added. No effect.
Thanks,
-Thomas
Thanks so much,
thomas
Thanks so much,
thomas
Thx
Sorry to ask so much of you. Hoever, how would I go about making it so that this movement can be controlled my two keys (A and D) I need this for testing, since my mouse has to be somewhere else. If not, no big deal
-Thomas
SnapFire said:
"I put that in there without getting rid of any of the other rules. However, it doesn't do anything at all. I realized that game.mouseangle is not actually used in any of the rules I have except the one you just gave me. So should I replace targetangle with mouseangle? I'm kind of confused. Right now I have the same things as before but with this new one added. No effect."
I meant that you should modify the existing constrain behavior's equation. You need to add all the other stuff into the existing equation. Also, you should use self.targetAngle. (In a previous example that you posted on 29 November you used game.mouseangle -- so I was trying to match what I thought you were using. But if you are using self.targetAngle then yes, the equation should have that instead.)
Hope this helps!
RThurman
When mouse is down:
---- Constrain Attribute: self.Position.X To: self.Position.X + (self.Position.X - mouse.Position.X)*.1
To get it to have the same 'feel' as the semicircle movement you need to have the same "gain factor" in both equations. That is, the number you use where the ".1" is, needs to be the same for both the semicirclar motion and the linear motion equations.
Hope this helps!
RThurman
-Thomas
One more thing - as usual
I'm planning on having a separate actor that moves to the left and right with the accelerometer, then put that actor's X Position in instead of the MousePosition.X
I assume that will work. I'm trying the flat version now. Thanks once more for all your help.
-Thomas
Trying the flat way now...
-Thomas
RThurman
Got the accelerometer. How would I make it so that when you touch part of the screen, nothing happens to the paddle? I need to have a part where you can touch without it affecting the paddle. Any Ideas?
I would say generally that you would need to use touch, rather than mouse down. Also you would need to have an actor that detects the touch and sets a (game) Boolean attribute to true. The actor would need to be big enough to cover all the 'touchable' area.
Then, while the Boolean attribute is true, detect the touch position and move the paddle accordingly.
Hope this helps,
RThurman
I made an actor for the touchable area, but now nothing works. I put in the Boolean Atribute like you said.
Now nothing works; won't move at all. Any ideas? I swear it's nothing on my part.
Also, I did what you said fr accelerometer, and it doesn't move smoothly like it does with the touch. It just moves in a defined patter, never slowing down or speeding up. ???
Thanks for the help,
-Thomas
-Thomas