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
How do I create a specific movement for each instance of a family ?
I'm working on a ranged ennemy for a "rogue-like game".
here's his how he's working:
for each EnnemyRanged -> Set EnnemyRanged.DistanceToPlayer=sqrt((self.X - Player.X)^2 + (Self.Y-Player.Y)^2)
( EnnemyRanged.DistanceToPlayer < EnnemyRanged.SafeDistance ) -> Set EnnemyRanged.focus 2
Else ( EnnemyRanged.DistanceToPlayer >= EnnemyRanged.SafeDistance and ( EnnemyRanged.DistanceToPlayer <= EnnemyRanged.DetectionRange ) -> Set EnnemyRanged.focus 1
Else ( EnnemyRanged.DistanceToPlayer > Ennemy.DetectionRange ) -> set EnnemyRanged.focus 0
focus= 0 -> stop
focus=1 -> find path to player.x,player.y and move along
focus=2 -> enemy flee (too long to write)[/code:ma3r0yiq]
I've tried to use "for each instance" and "pick by UID" but seem like it doesn't work at all.
when i run my game it's the nearest ennemy who defined the movement of all the instances of this family, for instance all the ennemy go to the same place.
I want to each instance to determinate where he must go...
post the capx or a screenshot of the events?
"Find path" is an asynchronous operation - it takes time to calculate. You can't call "Move along path" right away. Add "On path found" and then do "Move along path".
ok i had this event but it still doesn't work.
Can you re-post with the new events?
OK, i make it simpler.
Maybe try moving event 42 to 51 as a subevent of 41, so you know only one Enemy is picked at a time.
Done but it still doesn't work...
You'd have to post a CAPX then to get better help.
What's a CAPX?
Develop games in your browser. Powerful, performant & highly capable.
Do "Save as a single file". This gives a filename.capx file. You can then put that on a file sharing service (dropbox), and post the link here.
sorry I forgot to close this topic is found a solution, anyway Thank you.