I need help with drag and drop

Get help using Construct 2

Post » Mon Sep 10, 2012 1:00 pm

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)



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.

Thanks
B
2
Posts: 4
Reputation: 258

Post » Mon Sep 10, 2012 2:16 pm

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)?
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Mon Sep 10, 2012 2:32 pm

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.
B
2
Posts: 4
Reputation: 258

Post » Mon Sep 10, 2012 2:55 pm

Nevermind thank you very much, it worked.
B
2
Posts: 4
Reputation: 258

Post » Mon Sep 10, 2012 3:35 pm

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.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Mon Sep 10, 2012 4:08 pm

Just a 3d box go from right to left
B
2
Posts: 4
Reputation: 258


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 22 guests