I need help with drag and drop

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello people,

    Im new at Construct 2 and I have a question. I am doing a "touch game"

    I've loaded a .gif file in Construct 2 and I let the animation stop from the beginning. (That worked and i have no problems with that)

    The .gif is a 3d box (about 80 frames). (Moves from the right side to the left side)

    <img src="http://i.imgur.com/qeI6c.png" border="0" />

    So heres my problem/question:

    (So the box.gif starts at the right side)

    What i want to do is: drag the object with drag and drop and let the animation frame add by 1. So when u drag it to the left, the object will "play" and follow your mouse to the left. A

    Optional: when you drag it to the right it will decrease the frame by 1.

    Hope you will understand what i mean.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Make a on tick event, which checks if the3Dbox.x is within the range of say 10-20 and if it is, set it to frame 2 and so on?

    A trickier but easier way could be to use a more complicated equation like taking 80 and multiplying it by 10 (assuming your screen is 800px) so that you can plan each 10 pixels to change the frame by 1. So make an on every tick eent which sets the frame of the animation to say.. floor(the3Dbox.x /10)?

  • ok so let's say I divide the certain amount of pixels that my work space has by the amount of frames from the animation, for example 15 pixels is 1 frame,. how would I be able to code this into the script, could you please explain it to me in detail? or give an example in code.

    I'm new to this software and I appreciate your help. Thanks.

  • Nevermind thank you very much, it worked.

  • If I may ask, what kind of 80 frames long animation you have there?

    Maybe there is a way to recreate that in event? having many objects with 80+ animation frames could really lower your game frame rate.

  • Just a 3d box go from right to left

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)