How can i move Sprites Like this?

• I have a Sprite with four Frames and I want to rotate this something like this

• Hmm, that is an interesting question...

You might be able to do something like by having the image point at the very center of the circle (of circles), then rotating while using a horizontal sine.

Getting them in sync with this method would seem like a nightmare (if it desyncs)

Edit: Sorry misunderstood. But not I'm not sure what you have, and what you want... You have a current animation?

• It looks like the four sprites are moving in a diamond shape.

Add an instance variable to the sprite and call it “t”. Set each of the four instances to 0,1,2 and 3.

Then create another sprite called “node” and place four instances in a diamond shape.

Then in events you can do this:

Every tick:

— sprite: add dt to t

— sprite: set x to lerp(node(int(self.t)).x, node(int(self.t)+1).x, self.t-int(self.t))

— sprite: set y to lerp(node(int(self.t)).y, node(int(self.t)+1).y, self.t-int(self.t))

• It looks like the four sprites are moving in a diamond shape.

Add an instance variable to the sprite and call it “t”. Set each of the four instances to 0,1,2 and 3.

Then create another sprite called “node” and place four instances in a diamond shape.

Then in events you can do this:

Every tick:

— sprite: add dt to t

— sprite: set x to lerp(node(int(self.t)).x, node(int(self.t)+1).x, self.t-int(self.t))

— sprite: set y to lerp(node(int(self.t)).y, node(int(self.t)+1).y, self.t-int(self.t))

Yes They are moving in a diamond shape

I did same as you said but nothing worked.

• Just tried the C3p file and works perfectly.

• Just tried the C3p file and works perfectly.

May be because I didn't understand what he exactly says and because I am not good in English. I have doubt about below lines which i didn't understand. Can you exaplain these in simple.

Add an instance variable to the sprite and call it “t”. Set each of the four instances to 0,1,2 and 3. Then create another sprite called “node” and place four instances in a diamond shape

• If you open his C3p check the instance variables.

• If you open his C3p check the instance variables.

I was talking about R0J0hound 's Suggestion.

• Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• It very well may not work since I haven’t tested it.

• Thanks

Thank you so much el3um4s to make c3p file

He has always a solution for any kind of problem.

Thanks again.

• can you please explain what is actually happening in this event. Actually This is working but I'm not getting what actually happening.

— sprite: set x to lerp(node(int(self.t)).x, node(int(self.t)+1).x, self.t-int(self.t))

— sprite: set y to lerp(node(int(self.t)).y, node(int(self.t)+1).y, self.t-int(self.t))

• You can access specific objects by their iid in expressions like so:

Sprite(0).x gets the first sprite’s x

Sprite(1).x gets the x from the second sprite.

So say you have four instances you can access their x’s with

Sprite(0).x

Sprite(1).x

Sprite(2).x

Sprite(3).x

Not only that but the number wraps around so you can use 4 to access the first one again.

So what that expression is doing is it uses the variable t to specify a location between instances.

For example with a t of 1.33

It takes instance 1 and instance 2 and uses lerp to find the location a third of the way from instance 1 and 2.