How do you . .
![Theodi](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Get an actor to bounce left and right depending where you tap on the actor?
I have the bounce left done, but making it bounce right isn't working.
The rule im using is this, If game.touch.touch1.x is less than self.position.x
then
change velocity etc.
But this isnt working for bouncing right, anyone know how to do this?
I have the bounce left done, but making it bounce right isn't working.
The rule im using is this, If game.touch.touch1.x is less than self.position.x
then
change velocity etc.
But this isnt working for bouncing right, anyone know how to do this?
Comments
Rule: When touch is pressed (or released)
then this next Rule IN the first one:
When game.touch.touch1.x is < than self.position.x
change velocity/direction, etc.
otherwise (the one in this second Rule)
When game.touch.touch1.x is > than self.position.x
change velocity/direction, etc.
Give that a whirl.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
It still only bounces left though, this is what i have done.
I created a rule, and entered When game.touch.touch1.x is < than self.position.x
change velocity/direction, etc.
OTHERWISE
When game.touch.touch1.x is > than self.position.x
change velocity/direction, etc.
Theo
When touch is released ---this is better than "pressed" in this instance, I've just thought---
Move To --- in the x box: game.Touches.Touch1.X and in the Y box: the Y position of the actor, if you only want it moving horizontally.
The other Rules would be best for a background actor to register the touches to move your moving actor - if you wanted to click outside of the actor to have it moved. Here is that again (slightly amended and using a boolean attribute called Move):
Rule: When touch is pressed
change attribute Move to 1
otherwise
change attribute Move to 0
And then in the Rules of the moving actor:
When attribute move is true
Move To game.touches.touch1.x, --- the y the same as the moving actor
Hope that does the trick now. :-)
When game.touch.touch1.x is > than self.position.x
change velocity/direction, etc.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
What I want to be able to do is, the actor to bounce when tapped. So If the player taps on the left side of the actor, it bounces right, and if tapped on the right, it bounces left.
Just go with:
When touch is released ---this is better than "pressed" in this instance, I've just thought---
Move To --- in the x box: game.Touches.Touch1.X and in the Y box: the Y position of the actor, if you only want it moving horizontally.
See if that's what you're after.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
So I removed all rules that apply to it bouncing, and ran the game, it still bounces left when pressed!? How can that be? There aren't any rules telling it to.
This is what happenes in my game and what I need it to do.
An actor is falling down, you have to tap it to make it bounce up, and left or right (depending on which side you tapped) So it bounces in an arc, not just left or right you know?
Right now its just traveling downwards now I took my rules off I had before.
Another problem I had before which I need help with is, when I tapped the actor, it bounced left, but if I held my finger down it carried on bouncing upwards, which is cheating, so how would I make it that it doesn't bounce if you hold your finger down? It should only bounce when you tap on it. Hope I'm making sense here!
Back to the holding finger down aspect: without seeing what Physics you're using I'm not 100% certain that a boolean attribute acting as a switch would work, but it might.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
1st rule
Touch Animation. When pressed actor animates, and plays a sound.
Then a collide with a wall to the right.
Then another collide with a wall to the left.
2nd rule
When game.pungi1 is true
after timer of 3 seconds, play sound, looped.
Control Camera
Rule 3
Attribute game.tap is true
accelerate direction 270 relative to actor, 350 speed.
Rule 4
(this doesn't work properly, it is supposed to be a score, depending on the actors height. I need this working to but can't get it to work)
attribute self.position.x is less than game.heightscore
change attribute game.heightscore to self.position.x
Thats it. Hope you can help!
using the math in that demo when the touch is release and magnitude is close enough to be a touch, would probably get you going
I still need to add a rule that makes it, so the player cant hold their finger down to keep the actor bouncing up, but they have to actually tap, and only if the actor is going down, otherwise the game is too easy, to just keep tapping. Anyone got idea about this?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Gyro do you know a good way to record a score? Based on the height of the actor. So it goes up everytime the actor goes a bit more upwards. A bit like papi jump?
So, put actor's max. y into an integer attribute, let's call it JumpHeight; say 10 divisions, so JumpHeight/10; result into a real attribute called JumpRes. Put floor(JumpRes) into another attr. called Jumpfinal.
Then when JumpFinal > 20 and < 40
---your score stuff
otherwise
when JumpFinal > 39 and < 60
---your score stuff
otherwise ---etc; i.e nesting the otherwise's.
Hope that gives you some sort of start.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
gyro I couldn't get the above to work for the score, Im not that experienced at GS yet I couldn't get it working!