Movement Problem!
MagoNicolas
Member, PRO Posts: 2,090
Hello, Im having a big problem trying to figure out how to move an Image (Square 30x30) 30 pixel to any direction. I dont want to appear 30 pixels further, i want it to move from on position to the other (30 pixels further) and stop.
I tried a lot of different ways. When I try it with time, it didnt give me always the same movement.
Any Clue?
Thanks!
I tried a lot of different ways. When I try it with time, it didnt give me always the same movement.
Any Clue?
Thanks!
Comments
For example:
Interpolate self.position.x to 250
-Duration 1
Interpolate self.position.y to 200
-Duration 1
This will move your actor to the specified x and y position and it will complete this move in 1 second. The duration is a real number so you can also make it something like 0.5 or 1.2. Play with this number to get the EXACT speed you want!
Interpolate can be used in MANY different ways! It is a powerful behavior!
Thanks!
It's just made of awesome
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
i think...
If what you are saying is correct, that would be a cool, albeit partial, workaround for images with glow or shadows.
If I Click the Button Up twise it doesn`t wait to finish the first movement.
I Make a button, When i touch it it change Atribute to 1.
When 1, actors move up 30 pixels with interpolate.
But if I press twise, it doesnt move fine.
Any suggestion?
use a move to behavior for each direction. To move right put 30 for X and 0 for Y and switch it to actor. For left put -30 for X and 0 for Y. Same idea for up and down but with the Y instead of the X. Should work.
It doesnt wait for the completition of first movement.
http://gamesalad.com/wiki/how_tos:platformer_tutorials
The first one deals with moving a player left and right, you can easily change it to be up and down or whatever you need.
I need a movement of 30 pixels each time I press Up. And the movement should last some time ( I do that with interploate)
The problem is that If I press 2 tiemes, it doesnt wait to finish the first movement.
Please Help.
Edit: FMG got this one...I was thinking movement occurred when the moving actor was clicked...but that is just dumb! ;-)
Only allow the player to move when busy is false.
As soon as you hit the move key, set busy to true
Then have a Timer that sets it back to false.
Like this:
Rule
When all conditions are valid
game.busy = false
-----Change Attribute: game.busy To: true
-----Interpolate
-----Timer After [same amount of time as Interpolate] Run To Completion true
----------Change Attribute: game.busy To: false
EDIT: barkbark beat me to it. But yes, same concept. I always have a 'busy' flag in my games. I use it all over the place to prevent the user from clicking or tapping when they aren't allowed. I put it on all buttons, and during all transitions. It prevents bugs from people tapping too fast.
Now i have another problem reletades to the same thing.
Will Ask for help later!
Im tring to make a game where you move in tiles (with interpolate) And there will be walls and items.
Any tutorial in gamesalad that use my tipe of movement?
Thanks
http://gamesalad.com/game/play/61487
Want to Make The Player to move by tiles within a Maze of Walls.
Please Help.
Thanks