Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I want to do angle(objPlayer.x, objPlayer.y, objPlayer.x, objPlayer.y)
angle(objPlayer.x, objPlayer.y, objPlayer.x, objPlayer.y)
So the underlined part is the first player who collided into the other, and not underlined is the victim.
What is the best way to choose instances mid event?
Develop games in your browser. Powerful, performant & highly capable.
In a collision or overlap event you can make use of system Pick nth instance, where instance 0 and instance 1 are the two involved in the event.
But how do I use this in an expression?
Such as? When you collide you can pick out the two instances using what I mentioned and then whenever you reference the object it is referring to the one picked.
angle(objPlayer(0).X, objPlayer(0).Y, objPlayer(1).X, objPlayer(1).Y)
If you have many instances of this object it may be handy to create a family with this object. Then you can refer to two different instances in the same event like this:
Object on collision with ObjectFamily
... angle (Object.x, Object.y, ObjectFamily.x, ObjectFamily.y)
This helps, thank you!