How do I make an object go back in mirror

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey guys,

    So I have this evil, malefic... fly that starts on the right side of the screen and goes all the way to the left side. What I want to do, is to go back once it reaches the left side of the screen (left limit of the layout), so it will have this track: <------------ then ----------->.

    Sorry if the questions seems stupid, I'm new to C2

    Regards,

    Andrei

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See if this helps:

  • It's great! Thanks. Can you explain it a bit please? I need to understand it, and then to make it stay at a certain height.

  • Sure... There are 2 events.

    With the first event:

    With evilFly | X >= WindowWidth - floor(Self.Width/2)

    I'm saying with evilFly's X value is equal to or greater than the width of the window, less half of the width of the width of evilFly.

    The Self.Width/2 means half of the width of evilFly. I'm using half of evilFly because evilFly's origin is in the center. So by subtracting half the width of evelFly I'm reversing evilFly's direction while evilFly is still completely in the window.

    The floor() is in there so that if there is a remainder when I divide the width of evilFly by 2, any remainder will be dropped.

    So when this event happens I change evilFly's Bullet angle of motion to -180, which sends it to the left. By the way you don't need the "-". If you use just 180 it means the same thing. I accidentally left the "-" in there.

    So with the event:

    evilFly | X <+ round(Self.Width/2)

    I'm basically doing the same thing for the left side. I could have used floor() here instead of round(). In either case evilFly would reverse direction while completely inside the window.

    So when this event happens I change evilFly's Bullet angle of motion to 0, which sends it to the right.

    By the way, I have a Bound to layout Behavior on evilFly. It's not necessary. It's just another one of those things I accidentally left in.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)