Pull-objects-towards-other-objects-engine problem

For questions about using Classic.

Post » Thu Nov 29, 2007 10:16 pm

Hi there! I'm trying to make some way to pull objects against each other. I've made two kinds of objects with physics. One Immovable, and i placed that one on some places around the screen. I then tried to make them pull the other object towards themself by inserting this code:



It works fine, eccept only one of the objecs affect the little ball. Why?

There's a .cap on this link:
[url:cu6r5ddm]http://www.mediafire.com/?8zhghimogyl[/url:cu6r5ddm]
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu Nov 29, 2007 10:21 pm

Removed.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Thu Nov 29, 2007 10:34 pm

I want it to react to all sprites at the same time. I changed the code to "add"/1000. That way i thought it wouldn't just trigger for one of the objecs, but it didn't change anything.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu Nov 29, 2007 10:41 pm

Removed.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Thu Nov 29, 2007 11:00 pm

My thought was that it would trigger once for each square, and the force would become something in between. Well, something like this is what i'm looking for.

[url:pem7awze]http://www.kloonigames.com/blog/games/pluto/[/url:pem7awze]

Or in .cap version something like this, but working with duplicates of the same object.

[url:pem7awze]http://www.mediafire.com/?acytncqv2xd[/url:pem7awze]
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu Nov 29, 2007 11:08 pm

Removed.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Thu Nov 29, 2007 11:15 pm

Also removed...
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu Nov 29, 2007 11:17 pm

Okay, here is your last file posted, but with duplicates. Notice the ball is pulled towards the larger cluster of duplicates.

http://www.mediafire.com/?enny12yzvs9
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Thu Nov 29, 2007 11:20 pm

Fixed it for you, using "For each object" loops, and "add force" instead of "set force." Added some extra balls to show that it works on all the balls. Try moving the boxes around into different arrangements, the balls will be drawn to larger clusters of boxes.

http://www.mediafire.com/?3xgpmzzz5bj

Edit:
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Nov 29, 2007 11:22 pm

@deadeye: Hehe, 3 minutes behind me.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests