event fires only once

  • In my game I have a enemy character, a Roc, that flies back and forth across the screen. I have an invisible line drawn down the center of the screen and an event attached to that line. When the Roc hits the line, for now, it is directed to move to the other side of the screen. Which it does. Another event on a line on the opposite side of the screen directs the character back to the center. The event should fire again and send the roc over to the other side of the screen.

    The purpose of the line is that when I have this working, the roc will be doing other things should certain conditions arise.

    Here's the link to my project. https://www.dropbox.com/s/0e14dnd4wgb0efn/Uru.capx?dl=0

    Thanks.

  • You should look at using a time-based sinusoidal curve for the Rocs position.

  • Hmm, custom path? Yeah, maybe I should look into that. Thanks.

  • beardman

    just took a look at your capx, and when the Roc is flying to the left, it is never hitting the centerline, or the farleftPt. The path ends before it makes contact with the line, so it never sets a new path. Probably because of where origins are... or something like that. Also, the Roc doesn't seem to want to fly very close to the left edge of the screen.

    So, I moved the farleftPt out from the edge (set its x to 25). And when finding a path to the left, I told it to subtract 50 from the x of the target to make sure it was going to hit the line: Find Path to (centerLine.X -50, centerLine.Y) or Find Path to (FarLeftPt.X -50, FarLeftPt.Y)

    I didn't have to change the path finding when it was flying to the right.

    After those changes it continuously flew back and forth just fine.

  • I did just that, and it still isn't working. Weird. Not sure what I'm doing wrong. Do you happen to have a copy of that .capx you modded? Thanks.

  • beardman

    here is the version that I modified... http://www.rieperts.com/games/forum/Uru.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Got it. Thanks!

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