8 direction behavior question

This forum is currently in read-only mode.
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Hi everyone,

    How can I set the angle of one object away from another? I'm trying to have one sprite run away from another. Having one chase another is so easy, and I'm sure the answers a no-brainer but I can't seem to get it!

  • Try this:

    0 - angle(sp1.x, sp1.y, sp2.x, sp2.y)[/code:2b89fxhs]
  • Thanks, Deadeye. That produced some interesting results where the object moved around a little in random directions relative to the player, but it didn't 'run away'. I take it then, that there is no simple way to do this?

  • Shouldn't it be simply 'move at angle: angle(sprite.x, sprite.y, sprite2.x, sprite2.y)'? (Reverse the object names if it's backwards)

  • Yeah, thanks guys. I'd just figured it out when Arima posted. Appreciate the help!

  • (Reverse the object names if it's backwards)

    Oh yeah, huh? Oops.

  • I too have a quick question about 8dir (and Custom movement), so I hope no one minds me asking my own question. : D

    <img src="http://i417.photobucket.com/albums/pp257/Emperor_Phoenix/Construct%20Problems/EnemyMovementProblem2.jpg">

    http://i417.photobucket.com/albums/pp25 ... oblem2.jpg

    EDIT: there's a link there. I hate how this forum now seems to cut image sizes so it can fit within the forum template. Frustrating!

    I'm using Custom Movement and 8 directions to make enemies that move from side to side and up-and-down. When they hit an object with the attribute 'Bouncer,' I want them to reverse their movement angle by 180 (so if an enemy is traveling right, it turns left; and if an enemy is going up, it turns down). However, none of the various solutions I've tried arrive at that outcome; the enemy hits the bouncer attribute object and then turns left invariably.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure, but I think you cant set the angle of the 8-direction behavior to 90, I believe it's range is from 0 to 7 like this:

    3 2 1

    4 # 0

    5 6 7

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