"Set mirrored" with the sine behavior?

Get help using Construct 2

Post » Tue Apr 02, 2013 1:26 am

I have a sprite with a sine behavior, and it moves horizontally. When the sprite moves right, I want my image to face right. When the sprite moves left, I want to mirror the image so it faces left.

How can I "set mirrored" or "set not mirrored" at either end of the horizontal motion?
B
3
Posts: 3
Reputation: 281

Post » Tue Apr 02, 2013 10:11 am

I'm sure there's a smarter way to do this, but here's my suggestion: create an instance variable called OldX. Every tick, set OldX to Self.X.

Then create two events to change the mirror:
if OldX < Self.X : set not mirrored
if OldX > Self.X : set mirrored
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Mon Apr 08, 2013 4:26 pm



This doesn't seem to work for my game for some reason.

Is there another way to do this or a capx.?
B
26
S
5
G
1
Posts: 10
Reputation: 2,836

Post » Sun Sep 20, 2015 6:00 pm

Has anyone figured this out? I'd also like to have my sprite change direction based on left/right horizontal sine movement.
Play Ball Walker App Store | Google Play | Amazon | HTML5

Image
B
21
S
4
Posts: 93
Reputation: 1,360

Post » Sun Sep 20, 2015 11:33 pm

The capx file by @A0Nasser found in this thread has a perfect example.
how-do-i-move-enemies-like-in-mario_t119088?&hilit=sine+mirror&start=10

Works for me!
Play Ball Walker App Store | Google Play | Amazon | HTML5

Image
B
21
S
4
Posts: 93
Reputation: 1,360


Return to How do I....?

Who is online

Users browsing this forum: Unconnected and 30 guests