johnsmith's Recent Forum Activity

  • Well thanks for your help mindfaQ

    But unfortunately that doesnt work for what I want to do as I keep modifying the bullet angle of motion, that's why I was going for a "set X,Y" event instead..this way the bullet behaviour is not altered and can continue doing his stuff..

    Also there is a problem in your example as the enemy still goes through walls from time to time..

    I think the detectors I'm using was a bad idea, and maybe I can trigger the "set X,Y" with something else (like the overlapping at offset ?) but as I said, Im kinda lost with how to change the cosinus formula..

    If anyone got an idea, I'd be glad to hear it ! :)

  • Yes they are straight walls, with atm only 90�angles (for floor, side wall & ceiling), but ideally I would also like to have some more fancy angles later..

    I've found a formula on this forum about Cosinus & sinus (which I dont really understand..but it's working so far). Im applying it with the help of 2 detectors for X & Y pinned to my ennemy and the event looks like this:

    Detector X overlapping wall

    --> Enemy set X to self.x-cos(self.Bullet.AngleOfMotion)*self.Bullet.Speed*dt

    Detector Y overlapping wall

    --> Enemy set Y to self.Y-sin(self.Bullet.AngleOfMotion)*self.Bullet.Speed*dt

    That works...but there is still a problem when this happens:

    (orange rectangle is Y detector, blue is X)

    <img src="http://i.imgur.com/Qh79369.jpg" border="0" />

    There, the enemy will just get stuck (if not worst)...as the wrong detector got triggered first.. :/

    And if I make both detectors the same size to cover the 4 corners "holes" then it doesnt work at all as they are both triggered at the same time...

    I dont know what to do here, I've tried many things but unsuccesfully so far..and as I dont really understand that cosinus formula It's hard for me to "tweak" it, so if anyone could help me on this that would be great, thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    I have an enemy with the bullet behaviour.

    When he sights the player, his angle goes toward the player.

    But if the distance between the player & enemy < 200, his angle changes to angle(playerXY,EnemyXY)+90 or -90, this way he starts to randomly turn around the player.

    My problem is when he collides with a wall...I'm preventing collision by using the "bounce off solid" but this gives a pretty bad result as the eneymy keep colliding itself against the wall (until randomly changing his angle again).

    So I was wondering, can I make it so the enemy slide against the wall (in the appropriate direction regarding his current angle of motion) instead of colliding with it ? How would I do that ?

    Or if you have any other solution to make it so the enemy avoids walls, I'm interrested.

    Thanks by advance for your help ! :)

johnsmith's avatar

johnsmith

Online Now

Member since 21 Jun, 2013
Last online 25 Nov, 2024

Twitter
johnsmith has 2 followers

Trophy Case

  • 11-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies