Drag-Drop ? setting frame when dragging (SOLVED)

Get help using Construct 2

Post » Fri Dec 13, 2013 12:19 am

I searched the tuts and forum and could not find a solution.
Thanks for looking.

This is regarding when using the drag and drop behaviour,
I only have horizontal enabled (left and right)
so I want to change the frame of sprite depending on
which direction the sprite is moving toward.

for example.,
if idle / dropped set to frame 0
if dragging left set frame to 1
If dragging right set frame to 2

Is there an easy method I am overlooking?

Thanks for your help

if possible pls include a sample capx.
much appreciated


SOLVED !! see tutorial here:


Click here for tutproducermark112013-12-14 06:30:13
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Dec 13, 2013 1:35 am

Hi producermark11 , Here is the .capx : (I can not post URL ,change @ to /)

https:@@[email protected]@[email protected]

After adding a object with [DragDrop] behavior , you need add a Mouse object to judge the left or right .
-----------------------
Solution:
Add a globe variable(maybe named OldX) to know where is your mouseX when you start

When you are dragging the object , using the OldX subtract the present mouseX ,to get the direction of your moving. If it is positive ,you are moving to right, if negative , is left.
B
5
S
1
Posts: 17
Reputation: 441

Post » Fri Dec 13, 2013 3:34 am

here is the link ....
https://www.dropbox.com/s/cfx23ye1pp5bahk/DropJudge.capx

@Zaoeyo
Thanks let me try that ...
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Dec 13, 2013 3:59 am

ok, the above link is the start of a solution..

Sorry, I'm new to this so I need a bit more help

Ok, let me include the 3 needed images...

so at rest/idle/dropped, I wanted the image with no arrows (frame 0),
when being moved/dragging left the image with the arrows pointing left
frame(1)
and when dragging right the image with arrows pointing to the right
frame(2)

The image should only change when a movement has been detected. and then change back when dropped.

So if a player drags left and right continuously, the image should change
from left arrow to right arrow over and over until drag-drop.
If a player click on with no movement = no change.

https://dl.dropboxusercontent.com/u/139486255/Image/swipe_page_test.png



https://dl.dropboxusercontent.com/u/139486255/Image/swipe_page_test_left.png

https://dl.dropboxusercontent.com/u/139486255/Image/swipe_page_test_right.png

anybody else care to upload a completed capx please. Very much appreciated.producermark112013-12-13 04:39:28
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Dec 13, 2013 4:42 am

@producermark11
Hi , i added a Event [Every Tick] to know every move's mouseX, and this may be what you want .

(@ to /)
https:@@[email protected]@[email protected]
B
5
S
1
Posts: 17
Reputation: 441

Post » Fri Dec 13, 2013 5:08 am

I see your event sheet ...

close but not quite there...
no new images show up.
text stopped working too

and
the new mouse position plus whatever movement (left or right),
determines whether a left arrow or right arrow image will appear.
and
nothing should happen if no movement is NOT detected.


producermark112013-12-13 05:21:16
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Dec 13, 2013 5:20 am

sorry , I uploaded a wrong file , here will work :( @ to /)
https: @@ www.dropbox.com @ s @ as90gh0leb2wk0t @ Judge%20update.capx
B
5
S
1
Posts: 17
Reputation: 441

Post » Fri Dec 13, 2013 5:23 am

B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Dec 13, 2013 5:27 am

That will work...
Thanks for your help. I do appreciate that
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Sat Dec 14, 2013 6:11 am

B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests