Player Slows Down
I am currently working on a game where the objective is for the character to eat (destroy) all of the blocks in a scene. To move, I make it so that when the person playing the game touches either to the right or left of the character, he will move to that location (X axis only, Y stays the same). After the character collides into one block, he immediately slows down, and will only return to his original speed once you release your finger and press down again. Obviously, this wouldn't make for very good gameplay, and am hoping that someone could help me out some more with this. Thanks.
Comments
Giacomo
I was planning on making a video showing my rules and behaviours, but after further looking at it I came up with a solution. I had an actor called 'Touch Me', which was the size of the whole screen. It recorded the touch X position. If it was greater than the player's X, I would change a boolean attribute called 'playerMoveRight' to true, and when released it changed to false. I did the same for Left, except instead of the touch being greater than the players X, it was less than.
In the Character actor, I had - If playerMoveRight is true (the same for playerMoveLeft), Move To touch.position.X (for X position), self.Position.Y (for Y). I ran into problems with this, so I changed 'Move To' to 'Accelerate Toward', using the same X and Y coordinates. This worked well. When touch was released, I had 'Change Attribute self.motion.linearVelocity.X (or something like that) to 0. Accelerate toward seemed to work better and slow the player down less.
However, if someone else had another solution for this, it would be greatly appreciated. Thanks.