attach object

For questions about using Classic.

Post » Wed Jul 08, 2009 6:54 pm

how can i attach object1 to another2
but object1 will be at the point where i placed it (it can be different every time)
and it will rotate and move with object2
AND :oops:
that i can attach this object multiple time in different points
B
2
G
3
Posts: 15
Reputation: 880

Post » Wed Jul 08, 2009 7:34 pm

Use the Image Point tool in the image editor to place some image points, then you can position other objects to these image points.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Jul 08, 2009 8:10 pm

i know but i dont want the object1 will be on image point
cuz the object1 can be on any position on the screen
B
2
G
3
Posts: 15
Reputation: 880

Post » Wed Jul 08, 2009 10:31 pm

use the stick method first pioneered by lucid in a thread about a 2d katamari damacy clone

in the following cap you can see it in action, it's not nearly as confusing as it sounds or looks
you don't need as many events as I have there, so try to figure out what they're each doing

I only put so many so you can see that it works in all situations
drag and drop the green or blue boxes
and hold the right mouse button to stop the green one from rotating, and rotate the blue one

in your actual cap, you'll obviously make the line sprite invisible
[url:21hqwnnj]http://files.getdropbox.com/u/1013446/anglethingy.cap[/url:21hqwnnj]
(saved in 99.3)




you make a sprite of horizontal line with the hotspot at the very left, and an imagepoint at the very right


then when it's time to stick an object B to object A
you set the line position to Object A position
set line width to distance(objecta.x,objecta.y,objectb.x,objectb.y)
and set angle of the line sprite to angle(objecta.x,objecta.y,objectb.x,objectb.y)
and set a private variable ORIGLINEANG to linesprite.angle-objecta.angle
and set a private variable ORIGANGB to objectb.angle
then you 'Always' set line sprite position to object a position, and 'always' set object b position to line position at imagepoint 1
always set line angle to objecta.angle+ORIGLINEANG
and 'always' set angle of objectb to objecta.angle+ORIGANGB
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jul 08, 2009 11:20 pm

its work but still i cant add the same object in other place
B
2
G
3
Posts: 15
Reputation: 880

Post » Thu Jul 09, 2009 12:35 am

you have to make events to add a line and an object each time you need it done
there's no reason this shouldn't work with multiple objects
use the object pairer or groups to keep each line and sprite aligned with eachother
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Jul 09, 2009 2:36 am

i mean spawn the same object multiple times
and every piece by itself
and some how its now working for me
when i did this on my game :\
B
2
G
3
Posts: 15
Reputation: 880


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests