how to move an object with touchevent

Get help using Construct 2

Post » Mon Apr 08, 2013 9:16 pm

Im trying to make an object move up, down, left or right when its touched depending on swipe direction but cant make it work. Some help would be very nice.

Thanks
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Tue Apr 09, 2013 4:03 pm

Really!? no one has any suggestions? I find that hard to believe!
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Tue Apr 09, 2013 4:19 pm

Usually providing more information about what you are trying to do is the best way to get a response. For example, why not just use the Drag & Drop behavior? What doesn't it do that you need?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Apr 09, 2013 7:07 pm

@MonDieu,

For example:
Condition:
On Touch screen;
Every 0.01 second;

Actions:
> move sprite 1 pixel toward position to Touch object;
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,214
Reputation: 18,486

Post » Tue Apr 09, 2013 8:03 pm

dont have much of a project yet to provide, I just wanted to make something simple to try out touch functions. The idea was to make a small game where you have 8 suqares numbered 1 to 8 in a 3x3 grid, so one square grid is empty, then the task would be to move them around to sort them by swiping on them. The swiped square should only move in the swipe direction if that space is free.

I tried to use "object touched" in a lot of different combinations but couldnt make the square move. :(
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Tue Apr 09, 2013 8:31 pm

So, simple use the Vertical shoot example of Construct 2, the sample uses the Touch events and a custom movement system made by @Ashley or @Tom.

If you look inside it, and on all other samples provided with the Construct, you'll learn a lot of how the events works =]
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,214
Reputation: 18,486

Post » Tue Apr 09, 2013 9:35 pm

Ok Ill look into that.

Thanx very much for the help
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Wed Jul 10, 2013 7:36 pm

Hi there ... Actually I'm working on something similar. I already calculated the angles(sort of) and assigned it to "directions" for some reason my object is not moving correctly tho... I'm trying to use the grid movement and I need my object to move one square in whatever direction I swipe. I'm having issues with the moving part ... some issue with how I'm implementing the angle "translation" to direction.
Probably because I'm multitasking at the moment and can't really concentrate on doing this right heheh. But at least its moving when I diagonally assign left and right now if it did it right when doing it side ways it would rock. I burrowed some of this from the "diablo like movement" sample and adapted the touch part. Any suggestions and or fixes are welcome. I hope it helps ... and if you guys have any suggestions or solutions to my issue they are welcome as well.
Swipe Tile walk Test

Just to clear it a bit.
I'm using the text to see what I'm doing also the Blue and red squares are for visual input on my part to see where my touch starts and ends.(they are not being used for anything but visual feedback)

----UPDATE----
After some hammering down on the situation i came to a possible cleaner solution. Here's my Generic Grid Walk I hope it helps for later use.
CapxRagevortex2013-07-11 21:58:28
Freefall Bird
B
37
S
8
G
5
Posts: 262
Reputation: 5,360


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests