MoveTo behevior collision problem

0 favourites
  • 7 posts
From the Asset Store
Perfect Particles
$2 USD
80% off
Particles support animations, collisions, effects and etc.
  • Hi everyone,

    I have a problem that has me very tired. Maybe someone can help me with it.

    I did a enemy, that patrols defined area, and when the Player is in range of LOS he trying to catch him.

    Problem is how to mirroring image of enemy when he moving to left or right side. I moving enemy by behevior MoveTo. So it's dosen't change angle of object. I don't have any idea how can i make to enemy know, if he moving left then mirror, and then in right not miror.

    Here is a screen of my work.

    <img src="http://oi59.tinypic.com/30bpytu.jpg" border="0" />

  • Give the policeman an instance variable OldX and add this event

    if policeman.OldX < policeman.x

    -set policeman mirrored

    • policeman set OldX to policeman.x

    else

    -set policeman not mirrored

    • policeman set OldX to policeman.x
  • You could also set the miirorong event together with the moveto event if you know if the destination is left or right from the current position.

  • What a simple solution! Thank You very much!

  • Little problem have, not every time. When the policeman hit obstacle on his path then image makeing miror and notmirror at the same time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see you've already got patrol state is left and patrol state is right..

    Couldn't you just use those for setting mirrored or not mirrored?

  • Nov I have problem with collision of Policeman. I moving him now by moveTo behavior but it's seems that ignores solid objects.

    If the player start beeing in LOS of policeman, he starts moving and it's ok. When player in that moment move and not beeing in LOS of policeman he stops on obstacle and back to patrol, OK. But when the policeman still seeing player and colides with obstacle, he's ignores solid and run through obstacle. WTF?

    Here past policeman events.

    <img src="http://oi62.tinypic.com/30sj7ed.jpg" border="0" />

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