Drag-Drop / setting frame when dragging left-right


Attached Files

The following files have been attached to this tutorial:



Download now 259.51 KB


2,111 visits, 3,459 views


This tutorial hasn't been translated.


Hi everybody,

Recently, I asked a question on the forum basically asking:

When using drag-drop behavior how do I change frames of the sprite?

(because it's not a simple press right left button event )

I was only enabling left and right movement and wanted to,

for example.,

if idle (dropped), set to frame 0

if dragging left, set frame to 1

If dragging right, set frame to 2

here is a demo:

Click Here for Demo

I got a response from @Zaoeyo, (thanks you BTW) who said ..


Add a globe variable(maybe named OldMouseX) to know where is your mouseX when you start

When you are dragging the object , using the OldMouseX subtract the present mouseX ,to get the direction of your moving. If it is positive ,you are moving to right, if negative , is left.

I have uploaded the capx ,

This 'game' does NOT require plugins.

and here is a view of the event sheet



Download now 259.51 KB

  • Order by
Want to leave a comment? Login or Register an account!