ome6a1717's Forum Posts

  • Anytime I ever try to use an angle parameter, it never works. I might not be setting it up right, but if I have an NPC sprite on the screen and set it so if the player is within 45 degrees of BadGuy.Angle, how does it know what Angle the badguy is at when not moving?

  • If I were to use distance, how would I set the angle of which the enemy would start chasing? (ie. if the enemy is looking right, and you are in his scope of 270 degrees to 90 degrees, he chases, otherwise continues patrolling)?

  • I've been trying to make my enemy NPCs patrol some sort of path and then attack the enemy if the player is in the LOS (line of sight).

    To do this, I'm using an invisible box sprite pinned to each badguy so when you are in the box, the enemy starts chasing you. Once you're out of the box, the enemy goes back his scripted patrol in whatever location he stopped at.

    The script I have is working, but only the patrol is working for 1 enemy. I'm wondering if anyone else has an easier way to do something like this?

    My main event looks like this :

    For each BadGuy

          If box is overlapping player, attack

          If box is NOT overlapping player, Bullet right, stop, bullet left, stop etc.

    Any help or advice would be much appreciated.

    Thanks,

    Steve

  • Hey BluePhaze,

    I actually did not create this post - just found it by searching, so I don't think I'm able to set it to [Resolved].

    Steve

  • Nevermind - I missed the For Each (Ordered) and was doing just For Each.

    But just for people who are unfamiliar with Construct 2, I figured I'd at least post the exact code:

    System Event (For Each (ordered) <yourspritename> Order by <yourspritename>.Y, descending.

    Sprite Event (compare Y) if Sprite.Y < Player.Y

    Sprite Event Is on Screen

    Action Sprite Event Move to top layer

    Hope that helps anyone else that was confused.

    Steve

  • If you have enemies overlapping each other, you'll need to check their own.Y and use the solution of sorting them behind each other.

    Has anyone figured this out with using the families idea (which is brilliant, by the way)?

  • Vee you are a genius!!

    Everything works great - just one small quibble. When on the right side of the target, the animation switches to WalkUp once you're at the 0 degree mark as opposed to the 324 mark.

    Thanks again - I really appreciate it.

    Steve

  • Hey Vee,

    I can't seem to open this - it says somehow that you're on version 118, while I'm on version 114. I purchased this off steam, so in theory it should always be up to date?

    Any chance it's short enough you can just upload an image?

    Thanks so much!

    Steve

  • Thanks :).

    This is basically what I'm trying to achieve:

    <img src="http://stevemazzaro.com/Example.png" border="0" />

    When the player enters one of the "WalkX" groups in the image, the BadGuy plays the "WalkX" animation. Right now it's doing this, but at a 0, 90, 180, & 270 degree setup. However, when I try setting what I currently have to "is between angle XY + XY", it still doesn't work.

    It's almost as if even while moving, the BadGuy's angle parameter is never actually set.

  • stevemazzaro.com/CAPXTest.zip

    Sorry try this.

  • stevemazzaro.com/CAPXTest.zip

    Here's the capx. The section you're looking at is in the Enemies group folder (1st couple of events)

    Thanks!

    Steve

  • Hey Vee,

    Could you maybe expand a little more on what you mean?

    Based on what you said, I did something similar which works, just not as well as I'd like it to:

    IF

    System Event (compare variables) - Player.X < BadGuy.X

    System Event (compare variables) - Player.Y < BadGuy.Y

    THEN

    Set BadGuy animation to "WalkLeft"

    Basically saying if the character is to the left of the BadGuy and above the BadGuy, the animation will play WalkLeft. While this kind of works, the animations change on diagonal increments.

    Let me know if you meant something else?

    Thanks,

    Steve

  • Sorry to bump, but has anyone been able to figure this out? I can't find an appropriate answer anywhere in the forums.

    Thanks,

    Steve

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have checked the FAQs, but my problems are usually so specific they're rarely covered.

    Thanks for all the input!

  • That's exactly what I'm doing, and also exactly what I was afraid of. Is there a tutorial or anything that gives an example of this? All the tutorials are either mirror based or don't care about rotating the object.