sticking objects

For questions about using Classic.

Post » Fri Oct 30, 2009 7:47 am

What I'm wanting to do is have this red ball always "stick" to the blue ball when it hits it, as in no matter what angle the blue ball rotates it will rotate around with it and staying the same place when it moves.
I figured it probablys involves trigonometry, but I'm not the best at math.



any help would be great!
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Fri Oct 30, 2009 10:24 am

This cap should help you out.
(i didn't make it)

http://www.mediafire.com/?zyyggwedkwd
B
2
S
1
G
4
Posts: 71
Reputation: 1,342

Post » Fri Oct 30, 2009 10:37 am

cheers, thats perfect.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Fri Oct 30, 2009 10:40 am

Don't forget to rotate the red sprite accordingly, if you want it to keep the angle relative to object it's stuck to.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Oct 30, 2009 6:18 pm

That should be easy enough to do, if you give the red ball a "stuckAngle" variable. When it sticks, set stuckAngle to it current angle, and after that Always -> Set angle to stuckAngle + blueBallSprite.angle
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Oct 30, 2009 7:05 pm

I have an old cap that does what you're saying
drag and drop either box

hold right mouse button to rotate:
[url:3nieaisv]http://dl.getdropbox.com/u/1013446/angular.cap[/url:3nieaisv]



coincidentally, I'm in the middle of adding math expressions and array actions to automate this in 's'
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests