Drag object along a track HELP!!

For questions about using Classic.

Post » Wed Apr 07, 2010 10:45 pm

Hello everyone, Im new to the community and I would very much appreciate your help with this

I want to have a sprite (a simple square), over a path or track ,and be able to use the mouse to hold and slide the box to the desired location on said track, when I release the mouse button it would stay in place.

I would have many such boxes and tracks on screen, being able to slide just one at a time...

What I am trying to create is something like this image:

http://www.okw.co.uk/products/okw/slide ... LKNB_A.jpg

The main difference that the tracks in this one are simple lines and I am thinking of having tracks that have shapes (simple shapes, an 'L' shape, a 'T' shape or a square for example).

Hope you have an insight as to how I could do this...I thank you in advance for your help

-Fade
B
2
G
2
Posts: 1
Reputation: 677

Post » Wed Apr 07, 2010 11:13 pm

>Mouse is over object
>Mouse button is down
>-object set x to mouse x
or
>-object set y to mouse y
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Apr 07, 2010 11:36 pm

What newt said. And to give you a little rough example that works with shapes like you wanted:

Slider Fun
[size=50:2acmrq4t]This file needs at least Construct version 0.99.7[/size:2acmrq4t]

Tracks can be horizontal or vertical which is indicated by a private variable 'orientation' which you have to set accordingly to "ver" or "hor". Also the sliders have a PV which indicates if they're being used atm. The events should explain themselves for the most part (I hope). If anything remains unclear feel free to ask.

Oh and welcome to the community Fade! :D
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests