Gradual Movement

For questions about using Classic.

Post » Sun May 17, 2009 9:51 am

Is there any way to make a physics object just gradually move, say i wanted a platform to slide to the right then back again and loop, is this possible, so far all i can make something do is teleport, not gradually move.
B
2
G
3
Posts: 28
Reputation: 906

Post » Sun May 17, 2009 10:24 am

The only way you can move physics objects properly, is to apply physics forces to them. If you do things, like set angle, or X and Y positions, it can do some weird stuff.

To make a platform slide, you would have to apply force in the desired direction. You may even have to make some invisible "tracks" with invisible "bump-stops" at each end to stop it from moving too far, messing up, and falling off the end.

If you have trouble with this, let me know... I can make a quick example as to how this would work in finer detail.

Make note, you may also need to play with settings like friction and elasticity in order to get things to work the way you want.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sun May 17, 2009 10:32 am

Ok thanks man will try this, what about non-physics objects? Is there a good way to do this? In MMF2 I have a setting where I have an object with a bouncing ball movement which is stopped at the start of frame, the object follows a path which goes round in a circle, when another object collides with it it starts the bouncing ball movement and the object floats away nicely. Am trying to reproduce this but am having trouble with it.

[quote="SoldjahBoy":3mcwrywb]The only way you can move physics objects properly, is to apply physics forces to them. If you do things, like set angle, or X and Y positions, it can do some weird stuff.

To make a platform slide, you would have to apply force in the desired direction. You may even have to make some invisible "tracks" with invisible "bump-stops" at each end to stop it from moving too far, messing up, and falling off the end.

If you have trouble with this, let me know... I can make a quick example as to how this would work in finer detail.

Make note, you may also need to play with settings like friction and elasticity in order to get things to work the way you want.

~Sol[/quote:3mcwrywb]
B
2
G
3
Posts: 28
Reputation: 906

Post » Sun May 17, 2009 4:54 pm

[quote="mikmanner":31irrmcd]Ok thanks man will try this, what about non-physics objects? Is there a good way to do this? In MMF2 I have a setting where I have an object with a bouncing ball movement which is stopped at the start of frame, the object follows a path which goes round in a circle, when another object collides with it it starts the bouncing ball movement and the object floats away nicely. Am trying to reproduce this but am having trouble with it.[/quote:31irrmcd]

Path movement is yet to be added to Construct, but it's happening sooner or later. What you have described above is completely possible with construct, though a path movement behaviour would make things a little easier...

You would have to (without using a lot of math):

1. create a sprite that is long and thin, like string. set the hotspot to one end and the action point to the other end

2. rotate the object using an event "always > rotate clockwise"

3. create your "ball" object, tell it to stick to the action point of the "string". Give this "ball" object either the bullet or ball behaviour.

4. if the "ball" is touched, destroy the string and set the behaviour ot accelerate the "ball" away.



Now, there are 101 ways of doing that... if you are good at math, you can try something like: (Thanks to Ashley for this next bit)

To rotate an object A degrees around point P:

Set 'distance' to distance(Object.X, Object.Y, P.X, P.Y)
Set 'angle' to angle(Object.X, Object.Y, P.X, P.Y)

Set X to P.X + cos(angle + A) * distance
Set Y to P.Y + sin(angle + A) * distance

Then you can use some more fancy math to make your object fly away on contact with something else...

There is no instant answer, since Construct is more powerful than MMF, there are so many ways to do the same thing... really it comes down to creative thinking and logic/puzzle solving. If you can think of a way it would work, chances are you can make it happen.

For pathing, you could even create several "points" objects that your "ball" follows... going to the first point, then the nest, then the next etc.

Let me know if any of that needs to be explained further... always glad to help.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon May 18, 2009 2:04 am

If you need a physics object to interact with an object controlled in some other way, set that one to "inmovable". Then you move it by other means, and physics objects will react to it (although somewhat improperly because of speed and acceleration info discrepancies)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests