The Dink Network

Reply to Re: Making sprites avoid each other

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 11th 2011, 03:23 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Oh wow that would be a hard script to make... I haven't given it much thought, but it's not a good idea to work with move() or move_stop() in this case. Instead, create an invisible sprite for each monster you want to have this behaviour and periodically change the location of this invisible sprite after checking the locations of the monsters themselves and comparing their values to determine direction and distance from each other. Then make them follow the invisible sprite to guide their movement. This will make it very smooth, but it would still be a "mathematically" hard script to write. If you can figure out a good algorithm to check the distance and direction (like a vector) and then adjust this vector to create the invisible sprite along, it might work and even look cool.