I have a problem that I think might be related to this extension. I have multiple enemies on a scrolling level that use bouncin ball movement until the player gets within 100 pixels of the enemy at which point they look in the direction of the player and move towards them. the problem is that only one of the enemies is doing this the others just bounce around as normal. why is this????
Not sure, usualy these types of problems have something to do with Object Scope, you can find an article by Pixelthief about it here: http://create-games.com/article.asp?id=1942
with the square box method, the distance will not always be even, for example if it is exactly 100 pixels horizontally and 100 pixels vertically it will be 100*sqrt(2) pixels away, or 141 pixels.
With the circle distance method, it will always be 100 pixels no matter what (give or take a few because of decimals etc)
So essentially with the square method, it will be moving towards the player sooner than it would if you used a circle method of detection.
yes it will work nicer with the distances, but if you're someone who doesn't have a good history of trigonometry & geometry, its 100x easier to just use the box method.
sorry the advanced math object for mmf2 doesnt seem to accept its pow function. that was a formula that i had from tgf. dont know why mmf screws it up. i even wrote it from scratch in mmf2 and it gave me the syntax error.
you can do distance like this without an extension.
one problem with using that formula, cecil, is that it will not work once you get up to very large numbers, like if you were working with a system that stored X & Y positions at 1000x dimensions, which is a common way to make movements smoother. And when you try to take 4000000^2 (which would be X = 4000, not unreasonable), you get a number so large that the expression editor has an integer overflow, and the results are meaningless tripe. I have a modified little function where it shaves down the significant digits of the input values, applies the distance formula, than multiplies it back up again. Been meaning to turn it into a nifty extension, but well, c++ isn't my bag.
Can anyone help me please..... For some bizarre reason only some of them are actually doing anything when i get near them. the source file is here: http://ab.remake.googlepages.com/Game.zip and is in mmf2. The code is in Alien Movement.
for some reason it doesnt like picking individual aliens
in the event
+alterable value b("alien") < 300
make it
+X position of "alien" > X("player")-300
-X position of "alien" < X("player")+300
-Y position of "alien" > Y("player")-300
-Y position of "alien" < Y("player")+300
-alterable value b("alien") < 300