How do a "snap" a drag movement?
xyloFUN
Member Posts: 1,593
Hey guys,
I am looking for a better way to bring in the lessons and songs for one of my apps and wonder, if I would just make a very wide graphic file and let the user slide the content left and right.
The reason I am doing this is that after I watched children play with the trumpet and clarinet, they "wanted" to slide the lessons rather than pushing a button!
Now I know how to constrain movement in one direction but what I don't know is how to "snap" the gfx into place once it is close to a hot spot?
This way, the songs would always be centred.
Has anyone done this before? I'd love to experiment with this a bit and if it makes sense, use that method.
Thanks
I am looking for a better way to bring in the lessons and songs for one of my apps and wonder, if I would just make a very wide graphic file and let the user slide the content left and right.
The reason I am doing this is that after I watched children play with the trumpet and clarinet, they "wanted" to slide the lessons rather than pushing a button!
Now I know how to constrain movement in one direction but what I don't know is how to "snap" the gfx into place once it is close to a hot spot?
This way, the songs would always be centred.
Has anyone done this before? I'd love to experiment with this a bit and if it makes sense, use that method.
Thanks
Comments
http://www.youtube.com/user/GameSaladCookbook#p/u/5/DzaA0gachYM
that is pretty much it!
I know the with of my graphics (1024 pixels) and the movement would be constrained in the X axis (left right movement only).
Basically, I don't want a scenario where a song is half cut off or someone sees notes to the left and to the right but nothing in the centre. All could be avoided with making it snap at the centre x axis.
When the movement is released within 100 pixels, the image would snap in place and the student can then play or keep on moving.
I think this behaviour would be the best i can implement because the kids are so used to sliding content and I watched over and over, even after pushing the arrow buttons, they still instinctively want to slide the content.
I will see if i get firemaples demo ....
thanks
p.s. if you come across something that is workable .... well, don't make me come down there and let the air out of your BMX bike!! LOL
Then do another rule when touch is greater then ( ) but less then ( ) then change attribute to center position. the numbers there will only be a couple plus and minus the center position. So if you only move a tiny bit in any dirfection is goes back to center. But if you move it past a certain point it snaps all the way. ANd if your behind a certain point it snaps the other direction and slides that way.
I just played around with it and it works. Not sure if there a better way to do it, but that should work
I kind of know what you are doing but I can not set this up ...
would you mind sending me that file so that i can see what you did and make a diagram for myself. Sorry, I am a visual guy and need to see it before I can do it.
Thanks
p.s. I have a new game idea for you which is unique, (not in itunes) and if you have time to make it ... you could be sailing by my place in a few months
John, it's ok ... I don't' want you to waste your time with this. I can always add snapping when i update
Also, thanks Scoots ... that is a great tut!
Could this be something that you're looking for?
just threw this together -
http://gamesalad.com/game/7940
if it is, just let me know and i'll send it to you since the GS website isn't allowing downloadable projects yet.
yes, that is heading in the right direction!
Basically, I have observed children wanting to "slide" rather than to push a button.
Sliding is quite easy to do but I want the motion to snap if it reaches the center!
How ever, there has to be an easy way to slide the actor again.
I am happy to see that snapping is possible and I really love the way you have done this because that is very useful for something else I am working on as well.
How did you do that Mr. Stromtrix?
Thinking about that one with the sliding..
in mine the gray actor has 2 change attributes to a circlex and y. then a little 4x4 invisible actor in it.
when circle collides with the 4x4 then constrain attribute to the circlex and y.
what's your email address and i'll send ya the project.
If I can dissect it, I could include it with the piano which will be amazing when I'm done with it!
littlecomposers ... atgmailcom
Basically, my plan is to, once more, just use a scene change because of the way the lessons can be played. Any other way would be too complex for me.
Thanks in advance