Moving Sprites: Force or Set Position?

Just started using Construct 2? Post your questions here

Post » Wed Jul 06, 2016 9:33 pm

Hello,

I need to design objects to move forward and then backwards when they collide with a wall and was wondering what the most efficient way was.

I came across the physics manual on Construct2 and it mentioned:
"Therefore it is highly recommended to control Physics objects entirely via the Physics behavior (by setting forces, impulses, torques etc.), rather than trying to manipulate objects by Set position, Set angle etc."

Should I use Set Position or go with forces assuming that the number of objects can be over 30 ?

Regards
B
7
S
3
Posts: 8
Reputation: 646

Post » Thu Jul 07, 2016 8:26 am

What object are you moving? Here's how I'm moving enemy worm sprites in my project. I actually have three different ways the worm can change direction. Check out lines 21-22. I think that's the easiest way to make a sprite(with a platform behavior) move the way your described. Hope this helps!

Image

edit: edited the picture
Last edited by heyguy on Thu Jul 07, 2016 8:56 am, edited 2 times in total.
B
28
S
14
G
21
Posts: 179
Reputation: 13,548

Post » Thu Jul 07, 2016 8:36 am

I think you could also use the bullet behaviour. It have the option to set "bounce of solids". Maybe that could work? It also has some physics stuff, gravity acceleration etc.
Follow my progress on Twitter
or in this thread Archer Devlog
B
37
S
15
G
17
Posts: 949
Reputation: 12,295

Post » Sun Jul 10, 2016 3:37 pm

Thank you both for the replies. I am not sure why did not receive an email alert when the post was answered.

I am looking to implement something as mentioned by "heyguy "

Thanks
B
7
S
3
Posts: 8
Reputation: 646


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests